diff --git a/.gitignore b/.gitignore index 1560c1b..872283f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ xcuserdata *.moved-aside *.xcuserstate *.xcscmblueprint +docs ## Obj-C/Swift specific *.hmap diff --git a/.jazzy.yml b/.jazzy.yml new file mode 100644 index 0000000..035f3e2 --- /dev/null +++ b/.jazzy.yml @@ -0,0 +1,10 @@ +clean: true +author: polydice +author_url: https://github.com/polydice +github_url: https://github.com/polydice/ICInputAccessory +github_file_prefix: https://github.com/polydice/ICInputAccessory/blob/develop +xcodebuild_arguments: [-scheme, ICInputAccessory-iOS] +module: ICInputAccessory +module_version: 1.2.0 +output: docs/output +theme: fullwidth diff --git a/.travis.yml b/.travis.yml index 4c734a5..8f42f0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,15 @@ language: objective-c -osx_image: xcode7.3 -env: - matrix: - - VERSION=8.4 - - VERSION=latest +osx_image: xcode8 +matrix: + include: + - env: BUILD=9.3 + script: bundle exec rake ci:build[9.3] + - env: BUILD=latest + script: bundle exec rake ci:build[latest] + - env: BUILD=carthage + script: make carthage + after_script: + - make documentation cache: bundler: true directories: @@ -15,8 +21,6 @@ install: - make install before_script: - xcodebuild -workspace ICInputAccessory.xcworkspace -list -script: - - bundle exec rake ci:build[$VERSION] notifications: email: false slack: diff --git a/CHANGELOG.md b/CHANGELOG.md index a911495..e75987b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.2.0 + +#### Changes + +* Swift 2.3 + ## v1.1.0 #### Changes diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 1716855..e81455b 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -164,12 +164,12 @@ buildConfigurationList = B5E9F90D1C8D3B6E00443DC7 /* Build configuration list for PBXNativeTarget "Example" */; buildPhases = ( 96705876C946719953BCD0C6 /* [CP] Check Pods Manifest.lock */, + B5C50ADD1C917F4A0059032B /* Swift Lint */, B5E9F8F71C8D3B6E00443DC7 /* Sources */, B5E9F8F81C8D3B6E00443DC7 /* Frameworks */, B5E9F8F91C8D3B6E00443DC7 /* Resources */, CAB3B20531AAE2438C48D751 /* [CP] Embed Pods Frameworks */, 7B2FB96C7361D5883F3ADD14 /* [CP] Copy Pods Resources */, - B5C50ADD1C917F4A0059032B /* Swift Lint */, ); buildRules = ( ); @@ -192,10 +192,12 @@ TargetAttributes = { B548C5C11C8E91B0009D5AEE = { CreatedOnToolsVersion = 7.2.1; + LastSwiftMigration = 0800; TestTargetID = B5E9F8FA1C8D3B6E00443DC7; }; B5E9F8FA1C8D3B6E00443DC7 = { CreatedOnToolsVersion = 7.2.1; + LastSwiftMigration = 0800; }; }; }; @@ -361,6 +363,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessoryUITests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; TEST_TARGET_NAME = Example; USES_XCTRUNNER = YES; }; @@ -373,6 +376,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessoryUITests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; TEST_TARGET_NAME = Example; USES_XCTRUNNER = YES; }; @@ -395,7 +399,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -439,7 +443,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; @@ -469,6 +473,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessoryExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -483,6 +488,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessoryExample; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index 35c41bb..49c239b 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.0 + 1.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/ICInputAccessoryUITests/Info.plist b/Example/ICInputAccessoryUITests/Info.plist index 3b9aa4a..631d44c 100644 --- a/Example/ICInputAccessoryUITests/Info.plist +++ b/Example/ICInputAccessoryUITests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.1.0 + 1.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/Gemfile b/Gemfile index 309c365..43b86a4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,6 +2,7 @@ source "http://rubygems.org" ruby "2.3.1" gem "cocoapods", "~> 1.0.0" +gem "jazzy", "~> 0.7.0" gem "pry" gem "rake" gem "xcpretty" diff --git a/Gemfile.lock b/Gemfile.lock index 2ac56c0..a35ef83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: http://rubygems.org/ specs: - activesupport (5.0.0) + activesupport (5.0.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -28,8 +28,8 @@ GEM activesupport (>= 4.0.2) fuzzy_match (~> 2.0.4) nap (~> 1.0) - cocoapods-deintegrate (1.0.0) - cocoapods-downloader (1.1.0) + cocoapods-deintegrate (1.0.1) + cocoapods-downloader (1.1.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) @@ -45,22 +45,39 @@ GEM fourflusher (0.3.2) fuzzy_match (2.0.4) i18n (0.7.0) + jazzy (0.7.2) + cocoapods (~> 1.0) + mustache (~> 0.99) + open4 + redcarpet (~> 3.2) + rouge (~> 1.5) + sass (~> 3.4) + sqlite3 (~> 1.3) + xcinvoke (~> 0.2.1) + liferaft (0.0.4) method_source (0.8.2) minitest (5.9.0) molinillo (0.4.5) + mustache (0.99.8) nap (1.1.0) netrc (0.7.8) + open4 (1.3.4) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) rake (11.2.2) + redcarpet (3.3.4) rouge (1.11.1) + sass (3.4.22) slop (3.6.0) + sqlite3 (1.3.11) thread_safe (0.3.5) tzinfo (1.2.2) thread_safe (~> 0.1) - xcodeproj (1.2.0) + xcinvoke (0.2.1) + liferaft (~> 0.0.4) + xcodeproj (1.3.1) activesupport (>= 3) claide (>= 1.0.0, < 2.0) colored (~> 1.2) @@ -72,6 +89,7 @@ PLATFORMS DEPENDENCIES cocoapods (~> 1.0.0) + jazzy (~> 0.7.0) pry rake xcpretty diff --git a/ICInputAccessory.podspec b/ICInputAccessory.podspec index f2d77e7..8779195 100644 --- a/ICInputAccessory.podspec +++ b/ICInputAccessory.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ICInputAccessory" - s.version = "1.1.0" + s.version = "1.2.0" s.summary = "A customized token text field used in the iCook app." s.description = <<-DESC ICKeyboardDismissTextField: diff --git a/ICInputAccessory.xcodeproj/project.pbxproj b/ICInputAccessory.xcodeproj/project.pbxproj index e71fbe0..121e6aa 100644 --- a/ICInputAccessory.xcodeproj/project.pbxproj +++ b/ICInputAccessory.xcodeproj/project.pbxproj @@ -127,7 +127,7 @@ B56BC4211C89A7EA00C20AD6 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Polydice, Inc."; TargetAttributes = { B56BC4291C89A7EA00C20AD6 = { @@ -193,11 +193,13 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; @@ -222,6 +224,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -241,11 +244,13 @@ 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_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; @@ -262,6 +267,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -303,6 +309,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.polydice.ICInputAccessory; PRODUCT_NAME = ICInputAccessory; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; diff --git a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/ICInputAccessory-iOS.xcscheme b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/ICInputAccessory-iOS.xcscheme index 53a11dc..20d445f 100644 --- a/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/ICInputAccessory-iOS.xcscheme +++ b/ICInputAccessory.xcodeproj/xcshareddata/xcschemes/ICInputAccessory-iOS.xcscheme @@ -1,6 +1,6 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.0 + 1.2.0 CFBundleSignature ???? CFBundleVersion diff --git a/Makefile b/Makefile index 55471fd..40f22f2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ install: brew-install bundle-install pod-install brew-install: + brew update brew tap homebrew/bundle brew bundle @@ -13,3 +14,9 @@ pod-install: setup: brew-install bundle install bundle exec pod install --no-repo-update + +carthage: + set -o pipefail && carthage build --no-skip-current --verbose | xcpretty + +documentation: + bundle exec jazzy --config .jazzy.yml diff --git a/Podfile b/Podfile index 4d69ac8..a726ec4 100644 --- a/Podfile +++ b/Podfile @@ -9,3 +9,11 @@ target "Example" do pod "ICInputAccessory/KeyboardDismissTextField", path: "./" pod "ICInputAccessory/TokenField", path: "./" end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings["SWIFT_VERSION"] = "2.3" + end + end +end diff --git a/Podfile.lock b/Podfile.lock index 31383d6..a939432 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,6 +1,6 @@ PODS: - - ICInputAccessory/KeyboardDismissTextField (1.1.0) - - ICInputAccessory/TokenField (1.1.0) + - ICInputAccessory/KeyboardDismissTextField (1.2.0) + - ICInputAccessory/TokenField (1.2.0) DEPENDENCIES: - ICInputAccessory/KeyboardDismissTextField (from `./`) @@ -11,8 +11,8 @@ EXTERNAL SOURCES: :path: "./" SPEC CHECKSUMS: - ICInputAccessory: fa69a534ae8811866fa9d63a6b3ecf07bfced685 + ICInputAccessory: 75941a41865c7fab675c9252fd3101b79a7aea62 -PODFILE CHECKSUM: bc37f46eb6efd595acab704850534a8198e06d74 +PODFILE CHECKSUM: 41c0babd8a8e47d9dc4741ac44d6bb453b85139d COCOAPODS: 1.0.1 diff --git a/README.md b/README.md index 6546e0b..25732d4 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,16 @@ Customized text fields used in the [iCook app](https://itunes.apple.com/app/id554065086). Try . -[![Build Status](https://travis-ci.org/polydice/ICInputAccessory.svg?branch=develop)](https://travis-ci.org/polydice/ICInputAccessory) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ICInputAccessory.svg)](https://img.shields.io/cocoapods/v/ICInputAccessory.svg) -![Platform](https://img.shields.io/cocoapods/p/ICInputAccessory.svg?style=flat) -![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) +[![Build Status](https://travis-ci.org/polydice/ICInputAccessory.svg)](https://travis-ci.org/polydice/ICInputAccessory) +[![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) +[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/ICInputAccessory.svg)](http://cocoadocs.org/docsets/ICInputAccessory/) +![Swift 2.3](https://img.shields.io/badge/Swift-2.3-orange.svg) ### ICKeyboardDismissTextField -* An input accessory view with a button to dismiss keyboard. +* A text field that has a button to dismiss keyboard on the input accessory view. ### ICTokenField @@ -26,8 +27,10 @@ Try . ICInputAccessory | iOS | Xcode | Swift ---------------- | :--: | :---: | ----- -`~> v1.0.0` | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg) -`~> v1.1.0` | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) +`~> 1.0.0` | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg) +`~> 1.1.0` | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg) +`~> 1.2.0` | 8.0+ | 8.0 | ![Swift 2.3](https://img.shields.io/badge/Swift-2.3-orange.svg) +`feature/swift-3`| 8.0+ | 8.0 | ![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg) ## Installation diff --git a/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift b/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift index 8b1659d..1b06b15 100644 --- a/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift +++ b/Source/KeyboardDismissTextField/ICKeyboardDismissAccessoryView.swift @@ -26,16 +26,18 @@ import UIKit +/// A customized keyboard accessory view with a dismiss button. @IBDesignable public class ICKeyboardDismissAccessoryView: UIView { /// The background color of the button to dismiss keyboard. - @IBInspectable var buttonColor: UIColor = Constants.ButtonColor { + @IBInspectable public var buttonColor: UIColor = Constants.ButtonColor { didSet { dismissButton.backgroundColor = buttonColor } } + /// The button to dismiss keyboard. public private(set) lazy var dismissButton: UIButton = { let _button = UIButton() let resources = NSBundle(forClass: self.dynamicType) @@ -57,11 +59,13 @@ public class ICKeyboardDismissAccessoryView: UIView { // MARK: - Initialization + /// Initializes and returns a newly allocated view object with the specified frame rectangle. public override init(frame: CGRect) { super.init(frame: frame) setUpSubviews() } + /// Returns an object initialized from data in a given unarchiver. public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setUpSubviews() diff --git a/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift b/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift index b0ecdf3..aefea51 100644 --- a/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift +++ b/Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift @@ -26,9 +26,11 @@ import UIKit +/// A text field that has a button to dismiss keyboard on the input accessory view. @IBDesignable public class ICKeyboardDismissTextField: UITextField { + /// The custom input accessory view with a button to dismiss keyboard. @IBOutlet public var keyboardAccessoryView: ICKeyboardDismissAccessoryView! { didSet { if UI_USER_INTERFACE_IDIOM() != .Phone { return } @@ -39,11 +41,13 @@ public class ICKeyboardDismissTextField: UITextField { // MARK: - Initialization + /// Initializes and returns a newly allocated view object with the specified frame rectangle. public override init(frame: CGRect) { super.init(frame: frame) setUpAccessoryView() } + /// Returns an object initialized from data in a given unarchiver. public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setUpAccessoryView() diff --git a/Source/TokenField/ICTokenField.swift b/Source/TokenField/ICTokenField.swift index 767bc0f..6d52e54 100644 --- a/Source/TokenField/ICTokenField.swift +++ b/Source/TokenField/ICTokenField.swift @@ -41,15 +41,13 @@ import UIKit } -//////////////////////////////////////////////////////////////////////////////// - - +/// A text field that groups input texts with delimiters. @IBDesignable public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDelegate { // MARK: - Public Properties - /// The receiver’s delegate. + /// The receiver's delegate. public weak var delegate: ICTokenFieldDelegate? /// Characters that completes a new token, defaults are whitespace and commas. @@ -117,7 +115,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele } } - /// Customized attributes for tokens in the normal state, e.g. NSFontAttributeName and NSForegroundColorAttributeName. + /// Customized attributes for tokens in the normal state, e.g. `NSFontAttributeName` and `NSForegroundColorAttributeName`. public var normalTokenAttributes: [String: NSObject]? { didSet { tokens.forEach { $0.normalTextAttributes = normalTokenAttributes ?? [:] } @@ -211,11 +209,13 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele // MARK: - Initialization + /// Initializes and returns a newly allocated view object with the specified frame rectangle. public override init(frame: CGRect) { super.init(frame: frame) setUpSubviews() } + /// Returns an object initialized from data in a given unarchiver. public required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setUpSubviews() @@ -365,9 +365,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele // MARK: - Private Methods - /** - Returns true if any highlighted token is found and removed, otherwise false. - */ + /// Returns true if any highlighted token is found and removed, otherwise false. private func removeHighlightedToken() -> Bool { for (index, token) in tokens.enumerate() { if token.highlighted {