Skip to content

Commit 422c065

Browse files
author
Bernard Gatt
committed
Merge branch 'release/0.7.0'
2 parents d2fcf49 + 2feedfe commit 422c065

File tree

16 files changed

+87
-44
lines changed

16 files changed

+87
-44
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ language: objective-c
22

33
xcode_project: StyleKit.xcodeproj
44
xcode_scheme: StyleKit
5-
osx_image: xcode8.3
6-
xcode_sdk: macosx10.11
5+
osx_image: xcode9.1
6+
xcode_sdk: macosx10.13
77

88
script:
9-
- xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.3'
9+
- xcodebuild clean build test -project StyleKit.xcodeproj -scheme StyleKit -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.1'

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,15 @@ The levels of logging are:
154154

155155
#### Carthage
156156

157-
##### Swift 2.2 & 2.3
157+
##### Swift 3
158158

159159
```ogdl
160-
github "146BC/StyleKit" ~> 0.4
160+
github "146BC/StyleKit" ~> 0.6
161161
```
162-
163-
##### Swift 3
162+
##### Swift 4
164163

165164
```ogdl
166-
github "146BC/StyleKit" ~> 0.6
165+
github "146BC/StyleKit" ~> 0.7
167166
```
168167

169168
#### CocoaPods
@@ -175,14 +174,14 @@ source 'https://github.com/146BC/Specs.git'
175174
source 'https://github.com/CocoaPods/Specs.git'
176175
```
177176

178-
##### Swift 2.2 & 2.3
177+
##### Swift 3
179178

180179
```ruby
181-
pod 'StyleKit', '~> 0.4'
180+
pod 'StyleKit', '~> 0.6'
182181
```
183182

184-
##### Swift 3
183+
##### Swift 4
185184

186185
```ruby
187-
pod 'StyleKit', '~> 0.6'
188-
```
186+
pod 'StyleKit', '~> 0.7'
187+
```

StyleKit.xcodeproj/project.pbxproj

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,21 @@
293293
isa = PBXProject;
294294
attributes = {
295295
LastSwiftUpdateCheck = 0800;
296-
LastUpgradeCheck = 0800;
296+
LastUpgradeCheck = 0910;
297297
ORGANIZATIONNAME = "Bernard Gatt";
298298
TargetAttributes = {
299299
A100097B1DB02AF300C761CC = {
300300
CreatedOnToolsVersion = 8.0;
301+
LastSwiftMigration = 0910;
301302
ProvisioningStyle = Automatic;
302303
};
303304
A10FD6991D53FA2600341EDD = {
304305
CreatedOnToolsVersion = 7.3.1;
305-
LastSwiftMigration = 0800;
306+
LastSwiftMigration = 0910;
306307
};
307308
A10FD6A31D53FA2600341EDD = {
308309
CreatedOnToolsVersion = 7.3.1;
309-
LastSwiftMigration = 0800;
310+
LastSwiftMigration = 0910;
310311
TestTargetID = A100097B1DB02AF300C761CC;
311312
};
312313
};
@@ -428,7 +429,8 @@
428429
PRODUCT_BUNDLE_IDENTIFIER = OneFourSixBC.StyleKitTestsHost;
429430
PRODUCT_NAME = "$(TARGET_NAME)";
430431
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
431-
SWIFT_VERSION = 3.0;
432+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
433+
SWIFT_VERSION = 4.0;
432434
};
433435
name = Debug;
434436
};
@@ -443,7 +445,8 @@
443445
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
444446
PRODUCT_BUNDLE_IDENTIFIER = OneFourSixBC.StyleKitTestsHost;
445447
PRODUCT_NAME = "$(TARGET_NAME)";
446-
SWIFT_VERSION = 3.0;
448+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
449+
SWIFT_VERSION = 4.0;
447450
};
448451
name = Release;
449452
};
@@ -456,14 +459,20 @@
456459
CLANG_CXX_LIBRARY = "libc++";
457460
CLANG_ENABLE_MODULES = YES;
458461
CLANG_ENABLE_OBJC_ARC = YES;
462+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
459463
CLANG_WARN_BOOL_CONVERSION = YES;
464+
CLANG_WARN_COMMA = YES;
460465
CLANG_WARN_CONSTANT_CONVERSION = YES;
461466
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
462467
CLANG_WARN_EMPTY_BODY = YES;
463468
CLANG_WARN_ENUM_CONVERSION = YES;
464469
CLANG_WARN_INFINITE_RECURSION = YES;
465470
CLANG_WARN_INT_CONVERSION = YES;
471+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
472+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
466473
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
474+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
475+
CLANG_WARN_STRICT_PROTOTYPES = YES;
467476
CLANG_WARN_SUSPICIOUS_MOVE = YES;
468477
CLANG_WARN_UNREACHABLE_CODE = YES;
469478
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -510,14 +519,20 @@
510519
CLANG_CXX_LIBRARY = "libc++";
511520
CLANG_ENABLE_MODULES = YES;
512521
CLANG_ENABLE_OBJC_ARC = YES;
522+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
513523
CLANG_WARN_BOOL_CONVERSION = YES;
524+
CLANG_WARN_COMMA = YES;
514525
CLANG_WARN_CONSTANT_CONVERSION = YES;
515526
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
516527
CLANG_WARN_EMPTY_BODY = YES;
517528
CLANG_WARN_ENUM_CONVERSION = YES;
518529
CLANG_WARN_INFINITE_RECURSION = YES;
519530
CLANG_WARN_INT_CONVERSION = YES;
531+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
532+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
520533
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
534+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
535+
CLANG_WARN_STRICT_PROTOTYPES = YES;
521536
CLANG_WARN_SUSPICIOUS_MOVE = YES;
522537
CLANG_WARN_UNREACHABLE_CODE = YES;
523538
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -569,7 +584,8 @@
569584
SKIP_INSTALL = YES;
570585
SWIFT_OBJC_BRIDGING_HEADER = "";
571586
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
572-
SWIFT_VERSION = 3.0;
587+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
588+
SWIFT_VERSION = 4.0;
573589
};
574590
name = Debug;
575591
};
@@ -592,30 +608,35 @@
592608
PRODUCT_NAME = "$(TARGET_NAME)";
593609
SKIP_INSTALL = YES;
594610
SWIFT_OBJC_BRIDGING_HEADER = "";
595-
SWIFT_VERSION = 3.0;
611+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
612+
SWIFT_VERSION = 4.0;
596613
};
597614
name = Release;
598615
};
599616
A10FD6B21D53FA2600341EDD /* Debug */ = {
600617
isa = XCBuildConfiguration;
601618
buildSettings = {
619+
DEVELOPMENT_TEAM = "";
602620
INFOPLIST_FILE = StyleKitTests/Info.plist;
603621
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
604622
PRODUCT_BUNDLE_IDENTIFIER = BernardGatt.StyleKitTests;
605623
PRODUCT_NAME = "$(TARGET_NAME)";
606-
SWIFT_VERSION = 3.0;
624+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
625+
SWIFT_VERSION = 4.0;
607626
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StyleKitTestsHost.app/StyleKitTestsHost";
608627
};
609628
name = Debug;
610629
};
611630
A10FD6B31D53FA2600341EDD /* Release */ = {
612631
isa = XCBuildConfiguration;
613632
buildSettings = {
633+
DEVELOPMENT_TEAM = "";
614634
INFOPLIST_FILE = StyleKitTests/Info.plist;
615635
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
616636
PRODUCT_BUNDLE_IDENTIFIER = BernardGatt.StyleKitTests;
617637
PRODUCT_NAME = "$(TARGET_NAME)";
618-
SWIFT_VERSION = 3.0;
638+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
639+
SWIFT_VERSION = 4.0;
619640
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StyleKitTestsHost.app/StyleKitTestsHost";
620641
};
621642
name = Release;

StyleKit.xcodeproj/xcshareddata/xcschemes/StyleKit.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0910"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
<TestableReference
@@ -55,6 +56,7 @@
5556
buildConfiguration = "Debug"
5657
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5758
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
59+
language = ""
5860
launchStyle = "0"
5961
useCustomWorkingDirectory = "NO"
6062
ignoresPersistentStateOnLaunch = "NO"

StyleKit/Helpers/ColorHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public struct ColorHelper {
66

77
do {
88
let colorRegex = try NSRegularExpression(pattern: "^#[0-9a-f]{8}|#[0-9a-f]{6}|#[0-9a-f]{3}$", options: .caseInsensitive)
9-
let validColor = colorRegex.firstMatch(in: color, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, color.characters.count)) != nil
9+
let validColor = colorRegex.firstMatch(in: color, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, color.count)) != nil
1010
if validColor {
1111
return UIColor(hexString: color)
1212
} else {

StyleKit/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.3.0</string>
18+
<string>0.7.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

StyleKit/Utilities/ColorExtensions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extension UIColor {
55
var int = UInt32()
66
Scanner(string: hex).scanHexInt32(&int)
77
let a, r, g, b: UInt32
8-
switch hex.characters.count {
8+
switch hex.count {
99
case 3: // RGB (12-bit)
1010
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
1111
case 6: // RGB (24-bit)
@@ -20,6 +20,6 @@ extension UIColor {
2020
}
2121

2222
func getNSForegroundColorAttribute() -> [String:UIColor] {
23-
return [NSForegroundColorAttributeName:self]
23+
return [NSAttributedStringKey.foregroundColor.rawValue:self]
2424
}
2525
}

StyleKit/Utilities/SKTryCatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/**
77
Provides try catch functionality for swift by wrapping around Objective-C
88
*/
9-
+ (void)tryBlock:(void(^)())tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)())finallyBlock;
9+
+ (void)tryBlock:(void(^)(void))tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)(void))finallyBlock;
1010
+ (void)throwString:(NSString*)s;
1111
+ (void)throwException:(NSException*)e;
1212
@end

StyleKit/Utilities/SKTryCatch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ @implementation SKTryCatch
66
/**
77
Provides try catch functionality for swift by wrapping around Objective-C
88
*/
9-
+ (void)tryBlock:(void(^)())tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)())finallyBlock {
9+
+ (void)tryBlock:(void(^)(void))tryBlock catchBlock:(void(^)(NSException*exception))catchBlock finallyBlock:(void(^)(void))finallyBlock {
1010
@try {
1111
tryBlock ? tryBlock() : nil;
1212
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extension String {
22
func capitalizeFirstLetter() -> String {
3-
let first = String(characters.prefix(1)).capitalized
4-
let other = String(characters.dropFirst())
3+
let first = String(prefix(1)).capitalized
4+
let other = String(dropFirst())
55
return first + other
66
}
77
}

StyleKitDemo/StyleKitDemo.xcodeproj/project.pbxproj

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@
156156
isa = PBXProject;
157157
attributes = {
158158
LastSwiftUpdateCheck = 0730;
159-
LastUpgradeCheck = 0800;
159+
LastUpgradeCheck = 0910;
160160
ORGANIZATIONNAME = "Bernard Gatt";
161161
TargetAttributes = {
162162
A104CDFF1D57DCD500626F2A = {
163163
CreatedOnToolsVersion = 7.3.1;
164-
LastSwiftMigration = 0800;
164+
LastSwiftMigration = 0910;
165165
};
166166
};
167167
};
@@ -244,14 +244,20 @@
244244
CLANG_CXX_LIBRARY = "libc++";
245245
CLANG_ENABLE_MODULES = YES;
246246
CLANG_ENABLE_OBJC_ARC = YES;
247+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
247248
CLANG_WARN_BOOL_CONVERSION = YES;
249+
CLANG_WARN_COMMA = YES;
248250
CLANG_WARN_CONSTANT_CONVERSION = YES;
249251
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
250252
CLANG_WARN_EMPTY_BODY = YES;
251253
CLANG_WARN_ENUM_CONVERSION = YES;
252254
CLANG_WARN_INFINITE_RECURSION = YES;
253255
CLANG_WARN_INT_CONVERSION = YES;
256+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
257+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
254258
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
259+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
260+
CLANG_WARN_STRICT_PROTOTYPES = YES;
255261
CLANG_WARN_SUSPICIOUS_MOVE = YES;
256262
CLANG_WARN_UNREACHABLE_CODE = YES;
257263
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -293,14 +299,20 @@
293299
CLANG_CXX_LIBRARY = "libc++";
294300
CLANG_ENABLE_MODULES = YES;
295301
CLANG_ENABLE_OBJC_ARC = YES;
302+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
296303
CLANG_WARN_BOOL_CONVERSION = YES;
304+
CLANG_WARN_COMMA = YES;
297305
CLANG_WARN_CONSTANT_CONVERSION = YES;
298306
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
299307
CLANG_WARN_EMPTY_BODY = YES;
300308
CLANG_WARN_ENUM_CONVERSION = YES;
301309
CLANG_WARN_INFINITE_RECURSION = YES;
302310
CLANG_WARN_INT_CONVERSION = YES;
311+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
312+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
303313
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
314+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
315+
CLANG_WARN_STRICT_PROTOTYPES = YES;
304316
CLANG_WARN_SUSPICIOUS_MOVE = YES;
305317
CLANG_WARN_UNREACHABLE_CODE = YES;
306318
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -335,7 +347,8 @@
335347
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
336348
PRODUCT_BUNDLE_IDENTIFIER = OneFourSixBC.StyleKitDemo;
337349
PRODUCT_NAME = "$(TARGET_NAME)";
338-
SWIFT_VERSION = 3.0;
350+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
351+
SWIFT_VERSION = 4.0;
339352
};
340353
name = Debug;
341354
};
@@ -347,7 +360,8 @@
347360
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
348361
PRODUCT_BUNDLE_IDENTIFIER = OneFourSixBC.StyleKitDemo;
349362
PRODUCT_NAME = "$(TARGET_NAME)";
350-
SWIFT_VERSION = 3.0;
363+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
364+
SWIFT_VERSION = 4.0;
351365
};
352366
name = Release;
353367
};

StyleKitDemo/StyleKitDemo/CustomViews/SKButton.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ class SKButton: UIButton {
1616
updateBackgroundColorForState(state)
1717
}
1818
}
19-
19+
20+
@objc
2021
func setTransparency(_ alpha: NSNumber) {
2122
self.alpha = CGFloat(alpha.floatValue) / 100.0
2223
}
23-
24+
25+
@objc
2426
func setBackgroundColor(_ color: UIColor, forState state: UIControlState) {
2527
backgroundColors[state.rawValue] = color
2628

StyleKitDemo/StyleKitDemo/CustomViews/SKLabel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import UIKit
33

44
class SKLabel: UILabel {
55

6-
var padding: [CGFloat] = [0,0,0,0]
6+
@objc dynamic var padding: [CGFloat] = [0,0,0,0]
77

88
override func drawText(in rect: CGRect) {
99
let insets = UIEdgeInsets.init(top: padding[0], left: padding[1], bottom: padding[2], right: padding[3])

StyleKitTests/StyleTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class StyleTests: XCTestCase {
5959
// UINavigationBar
6060
XCTAssertEqual(navigationBar.tintColor, UIColor(hexString: "#000"))
6161

62-
if let navigationBarColor = navigationBar.titleTextAttributes?["NSColor"] as? UIColor {
62+
if let navigationBarColor = navigationBar.titleTextAttributes?[.foregroundColor] as? UIColor {
6363
XCTAssertEqual(navigationBarColor, UIColor(hexString: "#FF000000"))
6464
} else {
6565
XCTFail("Color not found in navigation")
6666
}
6767

68-
if let navigationBarFont = navigationBar.titleTextAttributes?["NSFont"] as? UIFont {
68+
if let navigationBarFont = navigationBar.titleTextAttributes?[.font] as? UIFont {
6969
XCTAssertEqual(navigationBarFont.fontName, "HelveticaNeue-Light")
7070
XCTAssertEqual(navigationBarFont.pointSize, 18.0)
7171
} else {

0 commit comments

Comments
 (0)