Skip to content

Commit

Permalink
Xcode 8: Swift 3.0 (#21)
Browse files Browse the repository at this point in the history
* Xcode 8

* Swift 3.0 (Xcode 8 b6) migration

* Swift 3.0 (Xcode 8 b6): fix syntax errors

* Swift 3.0 (Xcode 8 b6): update project settings

* Swift 3.0 (Xcode 8 b6): update example project

* Bump v2.0.0.beta.1

* Update Meta: 2.0.0.beta.1

* Update Example Cartfile: 2.0.0.beta.1

* Xcode 8: update CocoaPods version

* Fix Example: wrong didFinishLaunchingWithOptions

* Update gitignore

* Update README
  • Loading branch information
ricardopereira authored Sep 30, 2016
1 parent d7b6671 commit 236c821
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 206 deletions.
27 changes: 1 addition & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ xcuserdata/
## Other
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
Expand Down Expand Up @@ -67,29 +68,3 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output


### Xcode ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
2 changes: 1 addition & 1 deletion Example/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "whitesmith/WSTagsField"
github "whitesmith/WSTagsField" "2.0.0.beta.1"
1 change: 1 addition & 0 deletions Example/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "whitesmith/WSTagsField" "2.0.0.beta.1"
14 changes: 11 additions & 3 deletions Example/WSTagsFieldExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = Whitesmith;
TargetAttributes = {
D7F33FF11D2A7378003F0082 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -261,8 +262,10 @@
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";
Expand Down Expand Up @@ -306,8 +309,10 @@
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";
Expand All @@ -326,31 +331,34 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
D7F340051D2A7378003F0082 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = WSTagsFieldExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = co.whitesmith.WSTagsFieldExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
D7F340061D2A7378003F0082 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
INFOPLIST_FILE = WSTagsFieldExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = co.whitesmith.WSTagsFieldExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/WSTagsFieldExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
28 changes: 14 additions & 14 deletions Example/WSTagsFieldExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import WSTagsField
class ViewController: UIViewController {

let tagsField = WSTagsField()
let testButton = UIButton(type: .System)
let testButton = UIButton(type: .system)

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .redColor()
view.backgroundColor = .red
tagsField.placeholder = "Enter a tag"
tagsField.backgroundColor = .whiteColor()
tagsField.backgroundColor = .white
tagsField.frame = CGRect(x: 0, y: 44, width: 200, height: 44)
view.addSubview(tagsField)

Expand Down Expand Up @@ -48,26 +48,26 @@ class ViewController: UIViewController {
}

testButton.frame = CGRect(x: 0, y: 250, width: 100, height: 44)
testButton.backgroundColor = .whiteColor()
testButton.setTitle("Test", forState: .Normal)
testButton.backgroundColor = .white
testButton.setTitle("Test", for: UIControlState())
view.addSubview(testButton)
testButton.addTarget(self, action: #selector(didTouchTestButton), forControlEvents: .TouchUpInside)
testButton.addTarget(self, action: #selector(didTouchTestButton), for: .touchUpInside)
}

func didTouchTestButton(sender: AnyObject) {
func didTouchTestButton(_ sender: AnyObject) {
tagsField.padding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
tagsField.spaceBetweenTags = 10.0
tagsField.font = .systemFontOfSize(12.0)
tagsField.tintColor = .greenColor()
tagsField.textColor = .blackColor()
tagsField.fieldTextColor = .blueColor()
tagsField.selectedColor = .blackColor()
tagsField.selectedTextColor = .redColor()
tagsField.font = .systemFont(ofSize: 12.0)
tagsField.tintColor = .green
tagsField.textColor = .black
tagsField.fieldTextColor = .blue
tagsField.selectedColor = .black
tagsField.selectedTextColor = .red
tagsField.delimiter = ","
print(tagsField.tags)
}

override func viewDidAppear(animated: Bool) {
override func viewDidAppear(_ animated: Bool) {
if tagsField.isEditing == false {
tagsField.beginEditing()
}
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# WSTagsField

<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat"></a>
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)
[![SwiftPM Compatible](https://img.shields.io/badge/SwiftPM-Compatible-brightgreen.svg)](https://swift.org/package-manager/)
<a href="https://github.com/cocoapods/cocoapods"><img src="https://img.shields.io/cocoapods/v/WSTagsField.svg"></a>
[![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Platforms iOS](https://img.shields.io/badge/Platforms-iOS-lightgray.svg?style=flat)](https://developer.apple.com/swift/)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/WSTagsField.svg)](https://cocoapods.org/pods/WSTagsField)
[![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat)](https://developer.apple.com/swift/)
[![Platforms iOS](https://img.shields.io/badge/Platforms-iOS-lightgray.svg?style=flat)](http://www.apple.com/ios/)
[![Build Status](https://www.bitrise.io/app/059bc89743c769dc.svg?token=Wu0zdJtTsCQlVFSG1XuGIw&branch=master)](https://www.bitrise.io/app/059bc89743c769dc)
[![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)](https://opensource.org/licenses/MIT)

Expand All @@ -17,15 +17,15 @@ An iOS text field that represents different Tags.
``` swift

let tagsField = WSTagsField()
tagsField.backgroundColor = .whiteColor()
tagsField.backgroundColor = .white
tagsField.padding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
tagsField.spaceBetweenTags = 10.0
tagsField.font = .systemFontOfSize(12.0)
tagsField.tintColor = .greenColor()
tagsField.textColor = .blackColor()
tagsField.fieldTextColor = .blueColor()
tagsField.selectedColor = .blackColor()
tagsField.selectedTextColor = .redColor()
tagsField.font = .systemFont(ofSize: 12.0)
tagsField.tintColor = .green
tagsField.textColor = .black
tagsField.fieldTextColor = .blue
tagsField.selectedColor = .black
tagsField.selectedTextColor = .red
tagsField.delimiter = ","

// Events
Expand Down Expand Up @@ -64,7 +64,7 @@ tagsField.onDidChangeHeightTo = { sender, height in
To install it, simply add the following line to your **Cartfile**:

```ruby
github "whitesmith/WSTagsField"
github "whitesmith/WSTagsField" "2.0.0.beta.1"
```

Then run `carthage update`.
Expand All @@ -81,7 +81,7 @@ for up to date installation instructions.
To install it, simply add the following line to your **Podfile**:

```ruby
pod "WSTagsField"
pod "WSTagsField", :git => 'https://github.com/whitesmith/WSTagsField.git', :tag => '2.0.0.beta.1'
```

You will also need to make sure you're opting into using frameworks:
Expand All @@ -90,7 +90,7 @@ You will also need to make sure you're opting into using frameworks:
use_frameworks!
```

Then run `pod install` with CocoaPods 1.0 or newer.
Then run `pod install` with CocoaPods 1.1.0.beta.1 or newer.

#### <img src="https://dl.dropboxusercontent.com/u/11377305/resources/swiftpm.png" width="24" height="24"> [SwiftPM]

Expand All @@ -102,14 +102,14 @@ If your version of Swift supports the SPM, you just need to add WSTagsField as a
let package = Package(
name: "YOUR_PROJECT_NAME",
dependencies: [
.Package(url: "https://github.com/whitesmith/WSTagsField.git", , versions: "1.2.0" ..< Version.max),
.Package(url: "https://github.com/whitesmith/WSTagsField.git", , versions: "2.0.0" ..< Version.max),
...
]
...
)
```

(Note that the Swift Package Manager is still in early design and development, for more infomation checkout its repository)
(**Note** that the Swift Package Manager is still in early design and development, for more infomation checkout its repository)

#### Manually

Expand All @@ -118,7 +118,7 @@ Download all the source files and drop them into your project.
## Requirements

* iOS 8.0+
* Xcode 7 (Swift 2.2)
* Xcode 8 (Swift 3.0)

# Contributing

Expand Down
2 changes: 1 addition & 1 deletion Source/WSTag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct WSTag: Hashable {
return self.text.hashValue
}

public func equals(other: WSTag) -> Bool {
public func equals(_ other: WSTag) -> Bool {
return self.text == other.text
}

Expand Down
Loading

0 comments on commit 236c821

Please sign in to comment.