Skip to content

Commit

Permalink
Merge pull request #35 from bcylin/feature/swift-5
Browse files Browse the repository at this point in the history
Swift 5
  • Loading branch information
dlackty authored Jul 25, 2020
2 parents a7efb51 + c74192a commit f6b3e4d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 39 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

* Update CI infrastructure to GitHub Actions
* Swift 5.0

## v2.0.1

Expand Down
23 changes: 13 additions & 10 deletions ICInputAccessory.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -317,23 +317,23 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1110;
ORGANIZATIONNAME = "Polydice, Inc.";
TargetAttributes = {
B53376871F4436D000230739 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
};
B533769A1F4436D000230739 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
ProvisioningStyle = Automatic;
TestTargetID = B53376871F4436D000230739;
};
B56BC4291C89A7EA00C20AD6 = {
CreatedOnToolsVersion = 7.2.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1110;
};
};
};
Expand All @@ -342,6 +342,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -502,7 +503,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessory.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -521,7 +522,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessory.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -542,7 +543,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = Example;
};
name = Debug;
Expand All @@ -563,7 +564,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = Example;
};
name = Release;
Expand All @@ -572,6 +573,7 @@
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;
Expand Down Expand Up @@ -631,6 +633,7 @@
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;
Expand Down Expand Up @@ -695,7 +698,7 @@
PRODUCT_NAME = ICInputAccessory;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -715,7 +718,7 @@
PRODUCT_NAME = ICInputAccessory;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
24 changes: 10 additions & 14 deletions ICInputAccessory.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,6 +27,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B53376871F4436D000230739"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:ICInputAccessory.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -39,17 +48,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B53376871F4436D000230739"
BuildableName = "Example.app"
BlueprintName = "Example"
ReferencedContainer = "container:ICInputAccessory.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -71,8 +69,6 @@
ReferencedContainer = "container:ICInputAccessory.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "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 = "0930"
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -51,8 +49,6 @@
ReferencedContainer = "container:ICInputAccessory.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Customized text fields used in the [iCook app](https://itunes.apple.com/app/id55
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ICInputAccessory.svg)](https://cocoapods.org/pods/ICInputAccessory)
![Platform](https://img.shields.io/cocoapods/p/ICInputAccessory.svg)
![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg)
![Swift 5](https://img.shields.io/badge/Swift-5-orange.svg)

### KeyboardDismissTextField

Expand Down Expand Up @@ -36,6 +36,7 @@ ICInputAccessory | iOS | Xcode | Swift
`~> 1.4.0` | 8.0+ | 8.3 | ![Swift 3.1](https://img.shields.io/badge/Swift-3.1-orange.svg)
`~> 1.5.0` | 8.0+ | 9.3 | ![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg)
`~> 2.0.0` | 8.0+ | 10.0 | ![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg)
`develop` | 8.0+ | 11.1 | ![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg)

## Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class KeyboardDismissAccessoryView: UIView {
let _button = UIButton()
let resources = Bundle(for: type(of: self))
let icon = UIImage(named: "icook-iphone-button-hide-keyboard", in: resources, compatibleWith: nil)
_button.setImage(icon, for: UIControlState())
_button.setImage(icon, for: UIControl.State())
_button.backgroundColor = Constants.ButtonColor
_button.isExclusiveTouch = true
_button.layer.cornerRadius = 4
Expand Down
2 changes: 1 addition & 1 deletion Source/OptionPickerControl/OptionPickerControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ open class OptionPickerControl<T: OptionDescriptive>: UIControl, UIPickerViewDat
didSet {
if hiddenTextField.isFirstResponder {
sendActions(for: .valueChanged)
} else if let index = options.index(of: selectedOption) {
} else if let index = options.firstIndex(of: selectedOption) {
picker.selectRow(index, inComponent: 0, animated: false)
}
}
Expand Down
10 changes: 5 additions & 5 deletions Source/TokenField/Token.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class Token: UIView {
var text = "" {
didSet {
updateTextLabel()
frame = CGRect(origin: CGPoint.zero, size: systemLayoutSizeFitting(UILayoutFittingCompressedSize))
frame = CGRect(origin: CGPoint.zero, size: systemLayoutSizeFitting(UIView.layoutFittingCompressedSize))
}
}

Expand All @@ -41,7 +41,7 @@ internal class Token: UIView {
}
}

var normalTextAttributes: [NSAttributedStringKey: NSObject] = [
var normalTextAttributes: [NSAttributedString.Key: NSObject] = [
.foregroundColor: UIColor(red: 0.14, green: 0.38, blue: 0.95, alpha: 1),
.backgroundColor: UIColor.clear
] {
Expand All @@ -51,7 +51,7 @@ internal class Token: UIView {
}
}

var highlightedTextAttributes: [NSAttributedStringKey: NSObject] = [
var highlightedTextAttributes: [NSAttributedString.Key: NSObject] = [
.foregroundColor: UIColor.white,
.backgroundColor: UIColor(red: 0.14, green: 0.38, blue: 0.95, alpha: 1)
] {
Expand Down Expand Up @@ -93,8 +93,8 @@ internal class Token: UIView {
convenience init(
text: String,
delimiter: String = ",",
normalAttributes: [NSAttributedStringKey: NSObject]? = nil,
highlightedAttributes: [NSAttributedStringKey: NSObject]? = nil
normalAttributes: [NSAttributedString.Key: NSObject]? = nil,
highlightedAttributes: [NSAttributedString.Key: NSObject]? = nil
) {
self.init()
if let attributes = normalAttributes { normalTextAttributes = attributes }
Expand Down
4 changes: 2 additions & 2 deletions Source/TokenField/TokenField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ open class TokenField: UIView, UITextFieldDelegate, BackspaceTextFieldDelegate {
}

/// Customized attributes for tokens in the normal state, e.g. `.font` and `.foregroundColor`.
public var normalTokenAttributes: [NSAttributedStringKey: NSObject]? {
public var normalTokenAttributes: [NSAttributedString.Key: NSObject]? {
didSet {
tokens.forEach { $0.normalTextAttributes = normalTokenAttributes ?? [:] }
}
}

/// Customized attributes for tokens in the highlighted state.
public var highlightedTokenAttributes: [NSAttributedStringKey: NSObject]? {
public var highlightedTokenAttributes: [NSAttributedString.Key: NSObject]? {
didSet {
tokens.forEach { $0.highlightedTextAttributes = normalTokenAttributes ?? [:] }
}
Expand Down

0 comments on commit f6b3e4d

Please sign in to comment.