Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 140be3c

Browse files
author
Piergiuseppe Longo
committed
Fix style with SwiftLint
1 parent b53a830 commit 140be3c

11 files changed

Lines changed: 130 additions & 193 deletions

File tree

PGLFormatter/Date.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88

99
import Foundation
1010

11-
public extension Date{
12-
11+
public extension Date {
12+
1313
/**
1414
Returns a string representation of self formatted using the PGLFormatter.dateFormatter settings.
1515

1616
:returns: A string representation of date formatted using the PGLFormatter.dateFormatter settings.
1717
*/
1818

19-
func format() -> String{
19+
func format() -> String {
2020
return PGLFormatter.dateFormatter.string(from: self)
2121
}
22-
22+
2323
/**
2424
Returns a date representation of a given string interpreted using the PGLFormatter.dateFormatter settings.
2525
Parameters

PGLFormatter/Double.swift

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ public extension Double {
1515

1616
:returns: A string containing the formatted value of number using the PGLFormatter.numberFormatter settings.
1717
*/
18-
func format() -> String{
18+
func format() -> String {
1919
return PGLFormatter.numberFormatter.string(for: self)!
2020
}
21-
21+
2222
/**
2323
Converts a byte count into a string without creating an NSNumber object.
2424

@@ -27,53 +27,52 @@ public extension Double {
2727
func formatToByte() -> String {
2828
return PGLFormatter.byteFormatter.string(fromByteCount: Int64(self))
2929
}
30-
30+
3131
/**
3232
Format a number in meters to a localized string with the locale-appropriate unit and an appropriate scale (e.g. 4.3m = 14.1ft in the US locale).
3333

3434
:returns: A string that combines a value and a unit string appropriate for the PGLFormatter.lenghtFormatter's locale.
3535
*/
3636

37-
func formatLenghtFromMeters()->String{
37+
func formatLenghtFromMeters() -> String {
3838
return PGLFormatter.lenghtFormatter.string(fromMeters: self)
3939
}
40-
40+
4141
/**
4242
Format a combination of a number and an unit to a localized string.
4343
:param unit The unit used in the resulting length string.
4444

4545
:returns: A localized string that combines self value and unit.
4646
*/
47-
func formatLenght(_ unit: LengthFormatter.Unit)->String{
47+
func formatLenght(_ unit: LengthFormatter.Unit) -> String {
4848
return PGLFormatter.lenghtFormatter.string(fromValue: self, unit:unit)
4949
}
50-
50+
5151
/**
5252
Returns a mass string for self value.
5353

5454
:returns: A string that combines a value and a unit string appropriate for the formatter’s locale.
5555
*/
5656

57-
func formatMassFromKilograms()->String{
57+
func formatMassFromKilograms() -> String {
5858
return PGLFormatter.massFormatter.string(fromKilograms: self)
5959
}
60-
60+
6161
/**
6262
Returns a properly formatted mass string for self value and unit.
6363
:param: unit The unit used in the resulting mass string.
6464

6565
:returns: A localized string that combines self value and unit.
6666
*/
67-
func formatMass(_ unit: MassFormatter.Unit)->String{
67+
func formatMass(_ unit: MassFormatter.Unit) -> String {
6868
return PGLFormatter.massFormatter.string(fromValue: self, unit:unit)
6969
}
70-
71-
70+
7271
/**
7372
Returns a properly formatted time string for self
7473
:returns: A localized string that combines self.
7574
*/
76-
func formatTime()->String?{
75+
func formatTime() -> String? {
7776
return PGLFormatter.timeFormatter.string(from: self)
7877
}
7978

PGLFormatter/Float.swift

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
import Foundation
1010

1111
public extension Float {
12-
12+
1313
/**
1414
Returns a string containing the formatted value of the provided number object.
1515

1616
:returns: A string containing the formatted value of number using the PGLFormatter.numberFormatter settings.
1717
*/
18-
func format() -> String{
18+
func format() -> String {
1919
return PGLFormatter.numberFormatter.string(for:self)!
2020
}
21-
21+
2222
/**
2323
Converts a byte count into a string without creating an NSNumber object.
2424

@@ -27,57 +27,51 @@ public extension Float {
2727
func formatToByte() -> String {
2828
return PGLFormatter.byteFormatter.string(fromByteCount: Int64(self))
2929
}
30-
30+
3131
/**
3232
Format a number in meters to a localized string with the locale-appropriate unit and an appropriate scale (e.g. 4.3m = 14.1ft in the US locale).
3333

3434
:returns: A string that combines a value and a unit string appropriate for the PGLFormatter.lenghtFormatter's locale.
3535
*/
36-
func formatLenghtFromMeters()->String{
36+
func formatLenghtFromMeters() -> String {
3737
return PGLFormatter.lenghtFormatter.string(fromMeters: Double(self))
3838
}
39-
40-
39+
4140
/**
4241
Format a combination of a number and an unit to a localized string.
4342
:param unit The unit used in the resulting length string.
4443

4544
:returns: A localized string that combines self value and unit.
4645
*/
47-
func formatLenght(unit: LengthFormatter.Unit)->String{
46+
func formatLenght(unit: LengthFormatter.Unit) -> String {
4847
return PGLFormatter.lenghtFormatter.string(fromValue: Double(self), unit:unit)
4948
}
50-
51-
49+
5250
/**
5351
Returns a mass string for self value.
5452

5553
:returns: A string that combines a value and a unit string appropriate for the formatter’s locale.
5654
*/
57-
func formatMassFromKilograms()->String{
55+
func formatMassFromKilograms() -> String {
5856
return PGLFormatter.massFormatter.string(fromKilograms: Double(self))
5957
}
60-
61-
58+
6259
/**
6360
Returns a properly formatted mass string for self value and unit.
6461
:param: unit The unit used in the resulting mass string.
6562

6663
:returns: A localized string that combines self value and unit.
6764
*/
68-
func formatMass(unit: MassFormatter.Unit)->String{
65+
func formatMass(unit: MassFormatter.Unit) -> String {
6966
return PGLFormatter.massFormatter.string(fromValue: Double(self), unit:unit)
7067
}
71-
68+
7269
/**
7370
Returns a properly formatted time string for self
7471
:returns: A localized string that combines self.
7572
*/
76-
func formatTime()->String?{
73+
func formatTime() -> String? {
7774
return PGLFormatter.timeFormatter.string(from: Double(self))
7875
}
7976

8077
}
81-
82-
83-

PGLFormatter/Int.swift

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99
import Foundation
1010

1111
public extension Int {
12-
12+
1313
/**
1414
Returns a string containing the formatted value of the provided number object.
1515

1616
:returns: A string containing the formatted value of number using the PGLFormatter.numberFormatter settings.
1717
*/
18-
func format() -> String{
19-
20-
18+
func format() -> String {
19+
2120
return PGLFormatter.numberFormatter.string(for: self)!
2221
}
23-
22+
2423
/**
2524
Converts a byte count into a string without creating an NSNumber object.
2625

@@ -29,51 +28,50 @@ public extension Int {
2928
func formatToByte() -> String {
3029
return PGLFormatter.byteFormatter.string(fromByteCount: Int64(self))
3130
}
32-
31+
3332
/**
3433
Format a number in meters to a localized string with the locale-appropriate unit and an appropriate scale (e.g. 4.3m = 14.1ft in the US locale).
3534

3635
:returns: A string that combines a value and a unit string appropriate for the PGLFormatter.lenghtFormatter's locale.
3736
*/
38-
func formatLenghtFromMeters()->String{
37+
func formatLenghtFromMeters() -> String {
3938
return PGLFormatter.lenghtFormatter.string(fromMeters: Double(self))
4039
}
41-
40+
4241
/**
4342
Format a combination of a number and an unit to a localized string.
4443
:param unit The unit used in the resulting length string.
4544

4645
:returns: A localized string that combines self value and unit.
4746
*/
48-
func formatLenght(_ unit: LengthFormatter.Unit)->String{
47+
func formatLenght(_ unit: LengthFormatter.Unit) -> String {
4948
return PGLFormatter.lenghtFormatter.string(fromValue: Double(self), unit:unit)
5049
}
51-
50+
5251
/**
5352
Returns a mass string for self value.
5453

5554
:returns: A string that combines a value and a unit string appropriate for the formatter’s locale.
5655
*/
57-
func formatMassFromKilograms()->String{
56+
func formatMassFromKilograms() -> String {
5857
return PGLFormatter.massFormatter.string(fromKilograms: Double(self))
5958
}
60-
61-
59+
6260
/**
6361
Returns a properly formatted mass string for self value and unit.
6462
:param: unit The unit used in the resulting mass string.
6563

6664
:returns: A localized string that combines self value and unit.
6765
*/
68-
func formatMass(_ unit: MassFormatter.Unit)->String{
66+
func formatMass(_ unit: MassFormatter.Unit) -> String {
6967
return PGLFormatter.massFormatter.string(fromValue: Double(self), unit:unit)
7068
}
7169

7270
/**
7371
Returns a properly formatted time string for self
7472
:returns: A localized string that combines self.
7573
*/
76-
func formatTime()->String?{
74+
func formatTime() -> String? {
7775
return PGLFormatter.timeFormatter.string(from: Double(self))
7876
}
7977
}
@@ -87,7 +85,5 @@ public extension Int64 {
8785
func formatToByte() -> String {
8886
return PGLFormatter.byteFormatter.string(fromByteCount: self)
8987
}
90-
91-
9288

9389
}

PGLFormatter/NSNumberFormatter.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88

99
import Foundation
1010

11-
public extension NumberFormatter{
12-
13-
11+
public extension NumberFormatter {
12+
1413
/**
1514
Set the number of digit
1615
*/
1716

18-
func setPrecision(_ precision: Int){
17+
func setPrecision(_ precision: Int) {
1918
self.minimumFractionDigits = precision
2019
self.maximumFractionDigits = precision
2120
}

0 commit comments

Comments
 (0)