Skip to content

Commit 0dd8927

Browse files
authored
Merge pull request gizmosachin#34 from gizmosachin/sachin/swift-5
Support Swift 5.0
2 parents 7870725 + 20514bf commit 0dd8927

File tree

12 files changed

+78
-68
lines changed

12 files changed

+78
-68
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: objective-c
2-
osx_image: xcode10
2+
osx_image: xcode10.2
33
env:
44
global:
55
- LC_CTYPE=en_US.UTF-8
66
- LANG=en_US.UTF-8
77
before_install:
88
- bundle install
99
script:
10-
- xcodebuild -project ColorSlider/ColorSlider.xcodeproj -scheme ColorSlider -sdk iphonesimulator12.0 build analyze
10+
- xcodebuild -project ColorSlider/ColorSlider.xcodeproj -scheme ColorSlider -sdk iphonesimulator12.2 build analyze
1111
- bundle exec pod lib lint --verbose

ColorSlider.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Pod::Spec.new do |s|
22
s.name = 'ColorSlider'
3-
s.version = '4.3'
3+
s.version = '4.4'
44
s.summary = 'Snapchat-style color picker in Swift'
55
s.homepage = 'http://github.com/gizmosachin/ColorSlider'
66
s.license = 'MIT'
7-
s.documentation_url = 'http://gizmosachin.com/ColorSlider/'
7+
s.documentation_url = 'https://gizmosachin.github.io/ColorSlider/'
88

99
s.social_media_url = 'http://twitter.com/gizmosachin'
1010
s.author = { 'Sachin Patel' => '[email protected]' }
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
# platform
1717
s.platform = :ios
1818
s.ios.deployment_target = '9.0'
19-
s.swift_version = '4.2'
19+
s.swift_version = '5.0'
2020

2121
# build settings
2222
s.requires_arc = true

ColorSlider/ColorSlider.xcodeproj/project.pbxproj

+29-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
46E735B81C6338F900B63587 /* Project object */ = {
117117
isa = PBXProject;
118118
attributes = {
119-
LastUpgradeCheck = 0720;
119+
LastUpgradeCheck = 1020;
120120
ORGANIZATIONNAME = "Andrew Breckenridge";
121121
TargetAttributes = {
122122
46E735C01C6338F900B63587 = {
@@ -130,6 +130,7 @@
130130
developmentRegion = English;
131131
hasScannedForEncodings = 0;
132132
knownRegions = (
133+
English,
133134
en,
134135
);
135136
mainGroup = 46E735B71C6338F900B63587;
@@ -174,17 +175,28 @@
174175
isa = XCBuildConfiguration;
175176
buildSettings = {
176177
ALWAYS_SEARCH_USER_PATHS = NO;
178+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
177179
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
178180
CLANG_CXX_LIBRARY = "libc++";
179181
CLANG_ENABLE_MODULES = YES;
180182
CLANG_ENABLE_OBJC_ARC = YES;
183+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
181184
CLANG_WARN_BOOL_CONVERSION = YES;
185+
CLANG_WARN_COMMA = YES;
182186
CLANG_WARN_CONSTANT_CONVERSION = YES;
187+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
183188
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
184189
CLANG_WARN_EMPTY_BODY = YES;
185190
CLANG_WARN_ENUM_CONVERSION = YES;
191+
CLANG_WARN_INFINITE_RECURSION = YES;
186192
CLANG_WARN_INT_CONVERSION = YES;
193+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
194+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
195+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
187196
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
197+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
198+
CLANG_WARN_STRICT_PROTOTYPES = YES;
199+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
188200
CLANG_WARN_UNREACHABLE_CODE = YES;
189201
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
190202
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -222,17 +234,28 @@
222234
isa = XCBuildConfiguration;
223235
buildSettings = {
224236
ALWAYS_SEARCH_USER_PATHS = NO;
237+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
225238
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
226239
CLANG_CXX_LIBRARY = "libc++";
227240
CLANG_ENABLE_MODULES = YES;
228241
CLANG_ENABLE_OBJC_ARC = YES;
242+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
229243
CLANG_WARN_BOOL_CONVERSION = YES;
244+
CLANG_WARN_COMMA = YES;
230245
CLANG_WARN_CONSTANT_CONVERSION = YES;
246+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
231247
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
232248
CLANG_WARN_EMPTY_BODY = YES;
233249
CLANG_WARN_ENUM_CONVERSION = YES;
250+
CLANG_WARN_INFINITE_RECURSION = YES;
234251
CLANG_WARN_INT_CONVERSION = YES;
252+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
253+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
254+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
235255
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
256+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
257+
CLANG_WARN_STRICT_PROTOTYPES = YES;
258+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
236259
CLANG_WARN_UNREACHABLE_CODE = YES;
237260
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
238261
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -252,6 +275,7 @@
252275
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
253276
MTL_ENABLE_DEBUG_INFO = NO;
254277
SDKROOT = iphoneos;
278+
SWIFT_COMPILATION_MODE = wholemodule;
255279
TARGETED_DEVICE_FAMILY = "1,2";
256280
VALIDATE_PRODUCT = YES;
257281
VERSIONING_SYSTEM = "apple-generic";
@@ -263,6 +287,7 @@
263287
isa = XCBuildConfiguration;
264288
buildSettings = {
265289
CLANG_ENABLE_MODULES = YES;
290+
CODE_SIGN_IDENTITY = "";
266291
DEFINES_MODULE = YES;
267292
DYLIB_COMPATIBILITY_VERSION = 1;
268293
DYLIB_CURRENT_VERSION = 1;
@@ -274,14 +299,15 @@
274299
PRODUCT_NAME = "$(TARGET_NAME)";
275300
SKIP_INSTALL = YES;
276301
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
277-
SWIFT_VERSION = 4.0;
302+
SWIFT_VERSION = 5.0;
278303
};
279304
name = Debug;
280305
};
281306
46E735CB1C6338F900B63587 /* Release */ = {
282307
isa = XCBuildConfiguration;
283308
buildSettings = {
284309
CLANG_ENABLE_MODULES = YES;
310+
CODE_SIGN_IDENTITY = "";
285311
DEFINES_MODULE = YES;
286312
DYLIB_COMPATIBILITY_VERSION = 1;
287313
DYLIB_CURRENT_VERSION = 1;
@@ -292,7 +318,7 @@
292318
PRODUCT_BUNDLE_IDENTIFIER = tfw.ColorSlider;
293319
PRODUCT_NAME = "$(TARGET_NAME)";
294320
SKIP_INSTALL = YES;
295-
SWIFT_VERSION = 4.0;
321+
SWIFT_VERSION = 5.0;
296322
};
297323
name = Release;
298324
};

ColorSlider/ColorSlider.xcodeproj/xcshareddata/xcschemes/ColorSlider.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Demo/ColorSliderDemo.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
TargetAttributes = {
138138
037094711F70C38400C76883 = {
139139
CreatedOnToolsVersion = 9.0;
140-
LastSwiftMigration = 1000;
140+
LastSwiftMigration = 1020;
141141
ProvisioningStyle = Automatic;
142142
};
143143
};
@@ -316,7 +316,7 @@
316316
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
317317
PRODUCT_BUNDLE_IDENTIFIER = com.ColorSlider.ColorSliderDemo;
318318
PRODUCT_NAME = "$(TARGET_NAME)";
319-
SWIFT_VERSION = 4.2;
319+
SWIFT_VERSION = 5.0;
320320
TARGETED_DEVICE_FAMILY = "1,2";
321321
};
322322
name = Debug;
@@ -332,7 +332,7 @@
332332
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
333333
PRODUCT_BUNDLE_IDENTIFIER = com.ColorSlider.ColorSliderDemo;
334334
PRODUCT_NAME = "$(TARGET_NAME)";
335-
SWIFT_VERSION = 4.2;
335+
SWIFT_VERSION = 5.0;
336336
TARGETED_DEVICE_FAMILY = "1,2";
337337
};
338338
name = Release;

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
source 'https://rubygems.org' do
2-
gem 'cocoapods', '~> 1.5.3'
2+
gem 'cocoapods', '~> 1.6.1'
33
end

Gemfile.lock

+18-18
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,50 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
CFPropertyList (3.0.0)
5-
activesupport (4.2.10)
5+
activesupport (4.2.11.1)
66
i18n (~> 0.7)
77
minitest (~> 5.1)
88
thread_safe (~> 0.3, >= 0.3.4)
99
tzinfo (~> 1.1)
1010
atomos (0.1.3)
1111
claide (1.0.2)
12-
cocoapods (1.5.3)
12+
cocoapods (1.6.1)
1313
activesupport (>= 4.0.2, < 5)
1414
claide (>= 1.0.2, < 2.0)
15-
cocoapods-core (= 1.5.3)
15+
cocoapods-core (= 1.6.1)
1616
cocoapods-deintegrate (>= 1.0.2, < 2.0)
17-
cocoapods-downloader (>= 1.2.0, < 2.0)
17+
cocoapods-downloader (>= 1.2.2, < 2.0)
1818
cocoapods-plugins (>= 1.0.0, < 2.0)
1919
cocoapods-search (>= 1.0.0, < 2.0)
2020
cocoapods-stats (>= 1.0.0, < 2.0)
21-
cocoapods-trunk (>= 1.3.0, < 2.0)
21+
cocoapods-trunk (>= 1.3.1, < 2.0)
2222
cocoapods-try (>= 1.1.0, < 2.0)
2323
colored2 (~> 3.1)
2424
escape (~> 0.0.4)
25-
fourflusher (~> 2.0.1)
25+
fourflusher (>= 2.2.0, < 3.0)
2626
gh_inspector (~> 1.0)
27-
molinillo (~> 0.6.5)
27+
molinillo (~> 0.6.6)
2828
nap (~> 1.0)
29-
ruby-macho (~> 1.1)
30-
xcodeproj (>= 1.5.7, < 2.0)
31-
cocoapods-core (1.5.3)
29+
ruby-macho (~> 1.4)
30+
xcodeproj (>= 1.8.1, < 2.0)
31+
cocoapods-core (1.6.1)
3232
activesupport (>= 4.0.2, < 6)
3333
fuzzy_match (~> 2.0.4)
3434
nap (~> 1.0)
35-
cocoapods-deintegrate (1.0.2)
36-
cocoapods-downloader (1.2.1)
35+
cocoapods-deintegrate (1.0.4)
36+
cocoapods-downloader (1.2.2)
3737
cocoapods-plugins (1.0.0)
3838
nap
3939
cocoapods-search (1.0.0)
40-
cocoapods-stats (1.0.0)
40+
cocoapods-stats (1.1.0)
4141
cocoapods-trunk (1.3.1)
4242
nap (>= 0.8, < 2.0)
4343
netrc (~> 0.11)
4444
cocoapods-try (1.1.0)
4545
colored2 (3.1.2)
46-
concurrent-ruby (1.0.5)
46+
concurrent-ruby (1.1.5)
4747
escape (0.0.4)
48-
fourflusher (2.0.1)
48+
fourflusher (2.2.0)
4949
fuzzy_match (2.0.4)
5050
gh_inspector (1.1.3)
5151
i18n (0.9.5)
@@ -55,11 +55,11 @@ GEM
5555
nanaimo (0.2.6)
5656
nap (1.1.0)
5757
netrc (0.11.0)
58-
ruby-macho (1.3.1)
58+
ruby-macho (1.4.0)
5959
thread_safe (0.3.6)
6060
tzinfo (1.2.5)
6161
thread_safe (~> 0.1)
62-
xcodeproj (1.6.0)
62+
xcodeproj (1.8.2)
6363
CFPropertyList (>= 2.3.3, < 4.0)
6464
atomos (~> 0.1.3)
6565
claide (>= 1.0.2, < 2.0)
@@ -70,7 +70,7 @@ PLATFORMS
7070
ruby
7171

7272
DEPENDENCIES
73-
cocoapods (~> 1.5.3)!
73+
cocoapods (~> 1.6.1)!
7474

7575
BUNDLED WITH
7676
1.16.2

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ ColorSlider is an iOS color picker with live preview written in [Swift](https://
1010

1111
| | Features |
1212
| :-------: | :--------------------------------------- |
13-
| :ghost: | "[Snapchat](http://snapchat.com)-style" color picker |
13+
| :ghost: | "[Snapchat](https://snapchat.com)-style" color picker |
1414
| :rainbow: | Extensible live preview |
1515
| :art: | Customizable appearance |
1616
| :cyclone: | Vertical and horizontal support |
1717
| :musical_keyboard: | Black and white colors included |
18-
| :books: | Fully [documented](http://gizmosachin.github.io/ColorSlider) |
19-
| :baby_chick: | [Swift 4](https://developer.apple.com/swift/) |
18+
| :books: | Fully [documented](https://gizmosachin.github.io/ColorSlider) |
19+
| :baby_chick: | [Swift 5](https://developer.apple.com/swift/) |
2020

2121
## Usage
2222

@@ -44,7 +44,7 @@ Customize appearance attributes:
4444
``` Swift
4545
// Add a border
4646
colorSlider.gradientView.layer.borderWidth = 2.0
47-
colorSlider.gradientView.layer.borderColor = UIColor.white
47+
colorSlider.gradientView.layer.borderColor = UIColor.white.cgColor
4848

4949
// Disable rounded corners
5050
colorSlider.gradientView.automaticallyAdjustsCornerRadius = false
@@ -77,33 +77,33 @@ To disable the preview, simply pass `nil` to ColorSlider's initializer:
7777
let colorSlider = ColorSlider(orientation: .vertical, previewView: nil)
7878
```
7979

80-
See the [documentation](http://gizmosachin.github.io/ColorSlider) for more details on custom previews.
80+
See the [documentation](https://gizmosachin.github.io/ColorSlider) for more details on custom previews.
8181

8282
### Documentation
8383

84-
ColorSlider is fully documented [here](http://gizmosachin.github.io/ColorSlider).
84+
ColorSlider is fully documented [here](https://gizmosachin.github.io/ColorSlider).
8585

8686
## Installation
8787

8888
### [CocoaPods](https://cocoapods.org/)
8989

9090
``` ruby
9191
platform :ios, '9.0'
92-
pod 'ColorSlider', '~> 4.3'
92+
pod 'ColorSlider', '~> 4.4'
9393
```
9494

9595
### [Carthage](https://github.com/Carthage/Carthage)
9696

9797
``` ruby
98-
github "gizmosachin/ColorSlider" >= 4.3
98+
github "gizmosachin/ColorSlider" >= 4.4
9999
```
100100

101101
## Version Compatibility
102102

103103
| Swift Version | ColorSlider Version |
104104
| ------------- | ------------------- |
105+
| 5.0 | 4.3 |
105106
| 4.2 | master |
106-
| 4.0 | 4.2 |
107107

108108
## Demo
109109

Sources/ColorSlider.swift

+3-19
Original file line numberDiff line numberDiff line change
@@ -113,26 +113,10 @@ public class ColorSlider: UIControl {
113113

114114
/// The internal HSBColor representation of `color`.
115115
internal var internalColor: HSBColor
116-
117-
// Obsolete properties
118-
@available(*, obsoleted: 4.0, message: "A preview is now enabled by default, pass a `nil` preview to the initializer to disable it")
119-
public var previewEnabled: Bool = true
120-
121-
@available(*, obsoleted: 4.0, message: "Use layer.borderWidth instead")
122-
public var borderWidth: CGFloat = 0
123-
124-
@available(*, obsoleted: 4.0, message: "Use layer.borderColor instead")
125-
public var borderColor: UIColor = .white
126-
127-
@available(*, obsoleted: 4.0, message: "Use gradientView.layer.cornerRadius")
128-
public var cornerRadius: CGFloat = 0
129-
130-
@available(*, obsoleted: 4.0, message: "Use gradientView.automaticallyAdjustsCornerRadius instead")
131-
public var setsCornerRadiusAutomatically: Bool = true
132116

133-
@available(*, obsoleted: 4.0, message: "init(coder:) and Interface Builder support have been removed, use init(orientation:)")
117+
@available(*, unavailable)
134118
required public init?(coder aDecoder: NSCoder) {
135-
fatalError("init(coder:) and storyboard support have been removed, use init(orientation:)")
119+
fatalError("init(coder:) and storyboards are unsupported, use init(orientation:) instead.")
136120
}
137121

138122
// MARK: - Init
@@ -290,7 +274,7 @@ fileprivate extension ColorSlider {
290274
/// Updates the internal color and preview view when a touch event occurs.
291275
/// - parameter touch: The touch that triggered the update.
292276
/// - parameter touchInside: Whether the touch that triggered the update was inside the control when the event occurred.
293-
fileprivate func update(touch: UITouch, touchInside: Bool) {
277+
func update(touch: UITouch, touchInside: Bool) {
294278
internalColor = gradientView.color(from: internalColor, after: touch, insideSlider: touchInside)
295279
previewView?.colorChanged(to: color)
296280
}

0 commit comments

Comments
 (0)