Skip to content

Commit

Permalink
Merge pull request #25 from yoneapp/swift-3.0
Browse files Browse the repository at this point in the history
Update Swift 3.0
  • Loading branch information
mbuff24 committed Oct 21, 2016
2 parents 72b06e4 + 266f51b commit 833c7cc
Show file tree
Hide file tree
Showing 21 changed files with 193 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
Gemfile.lock

.DS_Store

Expand All @@ -26,4 +27,3 @@ DerivedData
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
Pods/
*.lock
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
language: objective-c
osx_image: xcode7.1
osx_image: xcode8

env:
global:
- LANG=en_US.UTF-8
- LC_ALL=en_US.UTF-8
matrix:
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="Router" SDK=iphonesimulator9.1
- DESTINATION="OS=8.2,name=iPhone 5" SCHEME="Router" SDK=iphonesimulator9.1
- DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="Router" SDK=iphonesimulator9.1
- DESTINATION="OS=8.4,name=iPhone 6" SCHEME="Router" SDK=iphonesimulator9.1
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="Router" SDK=iphonesimulator9.1
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="Router" SDK=iphonesimulator10.0
- DESTINATION="OS=8.2,name=iPhone 5" SCHEME="Router" SDK=iphonesimulator10.0
- DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="Router" SDK=iphonesimulator10.0
- DESTINATION="OS=8.4,name=iPhone 6" SCHEME="Router" SDK=iphonesimulator10.0
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="Router" SDK=iphonesimulator10.0

cache:
- bundler
- cocoapods

before_install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- bundler exec pod repo update --silent

script:
script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -workspace Router.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c
22 changes: 11 additions & 11 deletions Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let router = Router()

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let root = self.window?.rootViewController as! UINavigationController

router.bind("/route/one") { (req) -> Void in
let list: ViewController = storyboard.instantiateViewControllerWithIdentifier("routeOneList") as! ViewController
let list: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneList") as! ViewController
list.debugText = req.route.route
root.pushViewController(list, animated: true)
}

router.bind("/route/one/:id") { (req) -> Void in
let list: ViewController = storyboard.instantiateViewControllerWithIdentifier("routeOneList") as! ViewController
let list: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneList") as! ViewController
list.debugText = "deeplink from \(req.route.route)"

let detail: ViewController = storyboard.instantiateViewControllerWithIdentifier("routeOneDetail") as! ViewController
let detail: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneDetail") as! ViewController
detail.debugText = req.route.route
detail.id = req.param("id")!

Expand All @@ -50,30 +50,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
if let _ = router.match(url) {
private func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {
if let _ = router.match(url as URL) {
return true
}

Expand Down
24 changes: 12 additions & 12 deletions Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.viacom.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -18,6 +18,17 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.viacom</string>
<key>CFBundleURLSchemes</key>
<array>
<string>routerapp</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand All @@ -36,17 +47,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.viacom</string>
<key>CFBundleURLSchemes</key>
<array>
<string>routerapp</string>
</array>
</dict>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
6 changes: 3 additions & 3 deletions Example/MyRootViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class MyRootViewController: UIViewController {
let scheme = "routerapp://"

func doDeeplink(path: String) {
UIApplication.sharedApplication().openURL(NSURL(string: "\(scheme)\(path)")!)
UIApplication.shared.openURL(URL(string: "\(scheme)\(path)")!)
}

@IBAction func onListClick(sender: AnyObject) {
doDeeplink("route/one")
doDeeplink(path: "route/one")
}

@IBAction func onDetailClick(sender: AnyObject) {
doDeeplink("route/one/testing1234")
doDeeplink(path: "route/one/testing1234")
}

override func viewDidLoad() {
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "cocoapods"
2 changes: 1 addition & 1 deletion Integration/ExampleSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ExampleSpec: QuickSpec {

it("deeplink scheme is in plist") {
var plist: NSDictionary?
if let path = NSBundle.mainBundle().pathForResource("Info", ofType: "plist") {
if let path = Bundle.main.path(forResource: "Info", ofType: "plist") {
plist = NSDictionary(contentsOfFile: path)

let urlTypes = plist!["CFBundleURLTypes"] as! NSArray
Expand Down
2 changes: 1 addition & 1 deletion Integration/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.viacom.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion Integration/RouterExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RouterExampleTests: XCTestCase {

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
self.measure() {
// Put the code you want to measure the time of here.
}
}
Expand Down
20 changes: 14 additions & 6 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
workspace 'Router'
xcodeproj 'Router'
xcodeproj 'RouterExample'
project 'Router'
project 'RouterExample'

use_frameworks!

def testing_pods
pod 'Quick', '~> 0.8.0'
pod 'Nimble', '3.0.0'
pod 'Quick', '0.10.0'
pod 'Nimble', '5.0.0'
end

target 'RouterTests' do
testing_pods
xcodeproj 'Router'
project 'Router'
end

target 'RouterExampleTests' do
testing_pods
xcodeproj 'RouterExample'
project 'RouterExample'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
15 changes: 15 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PODS:
- Nimble (5.0.0)
- Quick (0.10.0)

DEPENDENCIES:
- Nimble (= 5.0.0)
- Quick (= 0.10.0)

SPEC CHECKSUMS:
Nimble: 56fc9f5020effa2206de22c3dd910f4fb011b92f
Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa

PODFILE CHECKSUM: d5997112d8acf5f755b82ce918845cdb642d599d

COCOAPODS: 1.0.1
Loading

0 comments on commit 833c7cc

Please sign in to comment.