Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #34 from gizmosachin/sachin/swift-5
Browse files Browse the repository at this point in the history
Support Swift 5.0
  • Loading branch information
gizmosachin authored Apr 9, 2019
2 parents 7870725 + 20514bf commit 0dd8927
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: objective-c
osx_image: xcode10
osx_image: xcode10.2
env:
global:
- LC_CTYPE=en_US.UTF-8
- LANG=en_US.UTF-8
before_install:
- bundle install
script:
- xcodebuild -project ColorSlider/ColorSlider.xcodeproj -scheme ColorSlider -sdk iphonesimulator12.0 build analyze
- xcodebuild -project ColorSlider/ColorSlider.xcodeproj -scheme ColorSlider -sdk iphonesimulator12.2 build analyze
- bundle exec pod lib lint --verbose
6 changes: 3 additions & 3 deletions ColorSlider.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Pod::Spec.new do |s|
s.name = 'ColorSlider'
s.version = '4.3'
s.version = '4.4'
s.summary = 'Snapchat-style color picker in Swift'
s.homepage = 'http://github.com/gizmosachin/ColorSlider'
s.license = 'MIT'
s.documentation_url = 'http://gizmosachin.com/ColorSlider/'
s.documentation_url = 'https://gizmosachin.github.io/ColorSlider/'

s.social_media_url = 'http://twitter.com/gizmosachin'
s.author = { 'Sachin Patel' => 'me@gizmosachin.com' }
Expand All @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
# platform
s.platform = :ios
s.ios.deployment_target = '9.0'
s.swift_version = '4.2'
s.swift_version = '5.0'

# build settings
s.requires_arc = true
Expand Down
32 changes: 29 additions & 3 deletions ColorSlider/ColorSlider.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
46E735B81C6338F900B63587 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Andrew Breckenridge";
TargetAttributes = {
46E735C01C6338F900B63587 = {
Expand All @@ -130,6 +130,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 46E735B71C6338F900B63587;
Expand Down Expand Up @@ -174,17 +175,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -222,17 +234,28 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -252,6 +275,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -263,6 +287,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -274,14 +299,15 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
46E735CB1C6338F900B63587 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -292,7 +318,7 @@
PRODUCT_BUNDLE_IDENTIFIER = tfw.ColorSlider;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions Demo/ColorSliderDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
TargetAttributes = {
037094711F70C38400C76883 = {
CreatedOnToolsVersion = 9.0;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -316,7 +316,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ColorSlider.ColorSliderDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -332,7 +332,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ColorSlider.ColorSliderDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org' do
gem 'cocoapods', '~> 1.5.3'
gem 'cocoapods', '~> 1.6.1'
end
36 changes: 18 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.10)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.5.3)
cocoapods (1.6.1)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.5.3)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.0, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
fourflusher (>= 2.2.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.5)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.5.7, < 2.0)
cocoapods-core (1.5.3)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.1)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.5)
escape (0.0.4)
fourflusher (2.0.1)
fourflusher (2.2.0)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
Expand All @@ -55,11 +55,11 @@ GEM
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.3.1)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.6.0)
xcodeproj (1.8.2)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -70,7 +70,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.5.3)!
cocoapods (~> 1.6.1)!

BUNDLED WITH
1.16.2
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ ColorSlider is an iOS color picker with live preview written in [Swift](https://

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

## Usage

Expand Down Expand Up @@ -44,7 +44,7 @@ Customize appearance attributes:
``` Swift
// Add a border
colorSlider.gradientView.layer.borderWidth = 2.0
colorSlider.gradientView.layer.borderColor = UIColor.white
colorSlider.gradientView.layer.borderColor = UIColor.white.cgColor

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

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

### Documentation

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

## Installation

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

``` ruby
platform :ios, '9.0'
pod 'ColorSlider', '~> 4.3'
pod 'ColorSlider', '~> 4.4'
```

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

``` ruby
github "gizmosachin/ColorSlider" >= 4.3
github "gizmosachin/ColorSlider" >= 4.4
```

## Version Compatibility

| Swift Version | ColorSlider Version |
| ------------- | ------------------- |
| 5.0 | 4.3 |
| 4.2 | master |
| 4.0 | 4.2 |

## Demo

Expand Down
22 changes: 3 additions & 19 deletions Sources/ColorSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,10 @@ public class ColorSlider: UIControl {

/// The internal HSBColor representation of `color`.
internal var internalColor: HSBColor

// Obsolete properties
@available(*, obsoleted: 4.0, message: "A preview is now enabled by default, pass a `nil` preview to the initializer to disable it")
public var previewEnabled: Bool = true

@available(*, obsoleted: 4.0, message: "Use layer.borderWidth instead")
public var borderWidth: CGFloat = 0

@available(*, obsoleted: 4.0, message: "Use layer.borderColor instead")
public var borderColor: UIColor = .white

@available(*, obsoleted: 4.0, message: "Use gradientView.layer.cornerRadius")
public var cornerRadius: CGFloat = 0

@available(*, obsoleted: 4.0, message: "Use gradientView.automaticallyAdjustsCornerRadius instead")
public var setsCornerRadiusAutomatically: Bool = true

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

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

0 comments on commit 0dd8927

Please sign in to comment.