├── .gitignore
├── .swift-version
├── .travis.yml
├── Example
├── AppDelegate.swift
├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── MyRootViewController.swift
└── ViewController.swift
├── Gemfile
├── Integration
├── ExampleSpec.swift
├── Info.plist
└── RouterExampleTests.swift
├── LICENSE
├── Podfile
├── Podfile.lock
├── README.md
├── Router.podspec
├── Router.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcshareddata
│ ├── xcbaselines
│ └── 819D12271AE5425D0009FEA1.xcbaseline
│ │ ├── EF97FBB9-9A2F-4C5E-B37D-748417F5274D.plist
│ │ └── Info.plist
│ └── xcschemes
│ └── Router.xcscheme
├── Router.xcworkspace
└── contents.xcworkspacedata
├── RouterExample.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── Source
├── Info.plist
├── Request.swift
├── Route.swift
├── Router.h
└── Router.swift
└── Tests
├── Info.plist
├── RouterMatchingPerfTests.swift
├── RouterSpecs.swift
└── RouterTests.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 | Gemfile.lock
20 |
21 | .DS_Store
22 |
23 | # CocoaPods
24 | #
25 | # We recommend against adding the Pods directory to your .gitignore. However
26 | # you should judge for yourself, the pros and cons are mentioned at:
27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
28 | #
29 | Pods/
30 |
--------------------------------------------------------------------------------
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.0
2 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: xcode8
3 |
4 | env:
5 | global:
6 | - LANG=en_US.UTF-8
7 | - LC_ALL=en_US.UTF-8
8 | matrix:
9 | - DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="Router" SDK=iphonesimulator10.0
10 | - DESTINATION="OS=8.2,name=iPhone 5" SCHEME="Router" SDK=iphonesimulator10.0
11 | - DESTINATION="OS=8.3,name=iPhone 5S" SCHEME="Router" SDK=iphonesimulator10.0
12 | - DESTINATION="OS=8.4,name=iPhone 6" SCHEME="Router" SDK=iphonesimulator10.0
13 | - DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="Router" SDK=iphonesimulator10.0
14 |
15 | cache:
16 | - bundler
17 | - cocoapods
18 |
19 | before_install:
20 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet
21 | - bundler exec pod repo update --silent
22 |
23 | script:
24 | - set -o pipefail
25 | - xcodebuild -version
26 | - xcodebuild -workspace Router.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO test | xcpretty -c
27 |
--------------------------------------------------------------------------------
/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import Router
19 |
20 | @UIApplicationMain
21 | class AppDelegate: UIResponder, UIApplicationDelegate {
22 |
23 | var window: UIWindow?
24 | let router = Router()
25 |
26 | private func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
27 | // Override point for customization after application launch.
28 |
29 | let storyboard = UIStoryboard(name: "Main", bundle: nil)
30 | let root = self.window?.rootViewController as! UINavigationController
31 |
32 | router.bind("/route/one") { (req) -> Void in
33 | let list: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneList") as! ViewController
34 | list.debugText = req.route.route
35 | root.pushViewController(list, animated: true)
36 | }
37 |
38 | router.bind("/route/one/:id") { (req) -> Void in
39 | let list: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneList") as! ViewController
40 | list.debugText = "deeplink from \(req.route.route)"
41 |
42 | let detail: ViewController = storyboard.instantiateViewController(withIdentifier: "routeOneDetail") as! ViewController
43 | detail.debugText = req.route.route
44 | detail.id = req.param("id")!
45 |
46 | root.pushViewController(list, animated: false)
47 | root.pushViewController(detail, animated: true)
48 | }
49 |
50 | return true
51 | }
52 |
53 | func applicationWillResignActive(_ application: UIApplication) {
54 | // 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.
55 | // 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.
56 | }
57 |
58 | func applicationDidEnterBackground(_ application: UIApplication) {
59 | // 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.
60 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
61 | }
62 |
63 | func applicationWillEnterForeground(_ application: UIApplication) {
64 | // 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.
65 | }
66 |
67 | func applicationDidBecomeActive(_ application: UIApplication) {
68 | // 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.
69 | }
70 |
71 | func applicationWillTerminate(_ application: UIApplication) {
72 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
73 | }
74 |
75 | private func application(application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {
76 | if let _ = router.match(url as URL) {
77 | return true
78 | }
79 |
80 | return false
81 | }
82 |
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/Example/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Example/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
28 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
83 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
133 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/Example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleURLTypes
22 |
23 |
24 | CFBundleURLName
25 | com.viacom
26 | CFBundleURLSchemes
27 |
28 | routerapp
29 |
30 |
31 |
32 | CFBundleVersion
33 | 1
34 | LSRequiresIPhoneOS
35 |
36 | UILaunchStoryboardName
37 | LaunchScreen
38 | UIMainStoryboardFile
39 | Main
40 | UIRequiredDeviceCapabilities
41 |
42 | armv7
43 |
44 | UISupportedInterfaceOrientations
45 |
46 | UIInterfaceOrientationPortrait
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UISupportedInterfaceOrientations~ipad
51 |
52 | UIInterfaceOrientationPortrait
53 | UIInterfaceOrientationPortraitUpsideDown
54 | UIInterfaceOrientationLandscapeLeft
55 | UIInterfaceOrientationLandscapeRight
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/Example/MyRootViewController.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 |
19 | class MyRootViewController: UIViewController {
20 |
21 | let scheme = "routerapp://"
22 |
23 | func doDeeplink(path: String) {
24 | UIApplication.shared.openURL(URL(string: "\(scheme)\(path)")!)
25 | }
26 |
27 | @IBAction func onListClick(sender: AnyObject) {
28 | doDeeplink(path: "route/one")
29 | }
30 |
31 | @IBAction func onDetailClick(sender: AnyObject) {
32 | doDeeplink(path: "route/one/testing1234")
33 | }
34 |
35 | override func viewDidLoad() {
36 | super.viewDidLoad()
37 |
38 | // Do any additional setup after loading the view.
39 | }
40 |
41 | override func didReceiveMemoryWarning() {
42 | super.didReceiveMemoryWarning()
43 | // Dispose of any resources that can be recreated.
44 | }
45 |
46 |
47 | /*
48 | // MARK: - Navigation
49 |
50 | // In a storyboard-based application, you will often want to do a little preparation before navigation
51 | override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
52 | // Get the new view controller using segue.destinationViewController.
53 | // Pass the selected object to the new view controller.
54 | }
55 | */
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/Example/ViewController.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import Router
19 |
20 | class ViewController: UIViewController {
21 |
22 | @IBOutlet weak var debugLabel: UILabel!
23 | var debugText: String?
24 | var id: String?
25 |
26 | override func viewDidLoad() {
27 | super.viewDidLoad()
28 | // Do any additional setup after loading the view, typically from a nib.
29 |
30 | if let debugText = debugText {
31 | debugLabel.text = debugText
32 | }
33 |
34 | if let id = id {
35 | debugLabel.text! += "- { id: '\(id)'}"
36 | }
37 | }
38 |
39 | override func didReceiveMemoryWarning() {
40 | super.didReceiveMemoryWarning()
41 | // Dispose of any resources that can be recreated.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | gem "cocoapods"
4 |
--------------------------------------------------------------------------------
/Integration/ExampleSpec.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import Quick
19 | import Nimble
20 |
21 | class ExampleSpec: QuickSpec {
22 |
23 | override func spec() {
24 |
25 | describe("plist config") {
26 |
27 | it("deeplink scheme is in plist") {
28 | var plist: NSDictionary?
29 | if let path = Bundle.main.path(forResource: "Info", ofType: "plist") {
30 | plist = NSDictionary(contentsOfFile: path)
31 |
32 | let urlTypes = plist!["CFBundleURLTypes"] as! NSArray
33 | let firstItem = urlTypes[0] as! NSDictionary
34 |
35 | let urlName = firstItem["CFBundleURLName"] as! String
36 | expect(urlName).to(equal("com.viacom"))
37 |
38 | let schemeArray = firstItem["CFBundleURLSchemes"] as! NSArray
39 | let firstScheme = schemeArray[0] as! String
40 | expect(firstScheme).to(equal("routerapp"))
41 | } else {
42 | expect(0).to(equal(1))
43 | }
44 | }
45 | }
46 |
47 | }
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/Integration/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Integration/RouterExampleTests.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import XCTest
19 |
20 | class RouterExampleTests: XCTestCase {
21 |
22 | override func setUp() {
23 | super.setUp()
24 | // Put setup code here. This method is called before the invocation of each test method in the class.
25 | }
26 |
27 | override func tearDown() {
28 | // Put teardown code here. This method is called after the invocation of each test method in the class.
29 | super.tearDown()
30 | }
31 |
32 | func testExample() {
33 | // This is an example of a functional test case.
34 | XCTAssert(true, "Pass")
35 | }
36 |
37 | func testPerformanceExample() {
38 | // This is an example of a performance test case.
39 | self.measure() {
40 | // Put the code you want to measure the time of here.
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2015 Viacom, Inc.
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | workspace 'Router'
2 | project 'Router'
3 | project 'RouterExample'
4 |
5 | use_frameworks!
6 |
7 | def testing_pods
8 | pod 'Quick', '0.10.0'
9 | pod 'Nimble', '5.0.0'
10 | end
11 |
12 | target 'RouterTests' do
13 | testing_pods
14 | project 'Router'
15 | end
16 |
17 | target 'RouterExampleTests' do
18 | testing_pods
19 | project 'RouterExample'
20 | end
21 |
22 | post_install do |installer|
23 | installer.pods_project.targets.each do |target|
24 | target.build_configurations.each do |config|
25 | config.build_settings['SWIFT_VERSION'] = '3.0'
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Nimble (5.0.0)
3 | - Quick (0.10.0)
4 |
5 | DEPENDENCIES:
6 | - Nimble (= 5.0.0)
7 | - Quick (= 0.10.0)
8 |
9 | SPEC CHECKSUMS:
10 | Nimble: 56fc9f5020effa2206de22c3dd910f4fb011b92f
11 | Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa
12 |
13 | PODFILE CHECKSUM: d5997112d8acf5f755b82ce918845cdb642d599d
14 |
15 | COCOAPODS: 1.0.1
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### Router
2 | [](https://travis-ci.org/ViacomInc/Router)
3 |
4 | A micro routing library written in swift, primarily for deep linking use cases
5 |
6 | ## Installation
7 |
8 | > **Embedded frameworks require a minimum deployment target of iOS 8.**
9 | >
10 | > Integration can be done either Manually or through Cocoapods
11 | >
12 |
13 | ### Cocoapods
14 |
15 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
16 |
17 | CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:
18 |
19 | ```bash
20 | $ gem install cocoapods
21 | ```
22 |
23 | To integrate Router into your Xcode project using CocoaPods, specify it in your `Podfile`:
24 |
25 | ```ruby
26 | platform :ios, '8.0'
27 | use_frameworks!
28 |
29 | pod 'Router', '~> 1.0.0'
30 | ```
31 |
32 | Then, run the following command:
33 |
34 | ```bash
35 | $ pod install
36 | ```
37 |
38 | ### Requirements
39 |
40 | - iOS 8.0+
41 | - Xcode 7.1
42 | - Swift 2.0
43 | - Cocoapods 0.36+ (Optional)
44 |
45 | ### Simple Usage
46 |
47 | ```swift
48 | import Router
49 |
50 | // create your router
51 | let router = Router()
52 |
53 | // bind your routes with a callback
54 | router.bind("/route/:id") { (req) -> Void in
55 | print(req.param("id")!)
56 | }
57 |
58 | // match a route
59 | let url = NSURL(string: "routerapp://route/abc123")!
60 | let route = router.match(url)
61 | ```
62 |
63 | ### Route binding
64 |
65 | Bind a closure to a route definition
66 |
67 | ```swift
68 | router.bind("/route/:id") { (req) -> Void in
69 | print(req.param("id")!)
70 | }
71 | ```
72 |
73 | ### Route Matching
74 |
75 | Matches an incoming url to a route in the Router. If a match is made, the closure is executed and the matched route is returned
76 |
77 | ```swift
78 | let url = NSURL(string: "routerapp://route/abc123")!
79 | let route = router.match(url)
80 | ```
81 |
82 |
83 | ### Request Object
84 |
85 | A request object is accessible in the closure arg. Access url params in the closure (ie. id from /route/:id) by using ```.param()``` function
86 |
87 | ```swift
88 | router.bind("/route/:id") { (req) -> Void in
89 | let id = req.param("id")!
90 | }
91 | ```
92 |
93 | Access query string params from the callback (ie. /route/123?foo=bar) by using ```.query()``` function
94 |
95 | ```swift
96 | router.bind("/route/:id") { (req) -> Void in
97 | let foo = req.query("foo")!
98 | }
99 | ```
100 |
101 | ### Deeplinking to the Sample app
102 |
103 | - Install the RouterExample app
104 | - Close the app
105 | - Open safari
106 | - Type routerapp://route/one into the address bar to access View One
107 | - Exit out of the app
108 | - Type routerapp://route/one/abc123 into the address bar to access View Two
109 |
110 | ### Found a bug?
111 |
112 | - Open up an issue
113 | - Write test(s) that reproduce the issue
114 | - Fix the issue
115 | - Send a Pull Request
116 |
117 | ### Want a feature request?
118 |
119 | - Open up an Issue
120 | - Write test(s) around the new feature
121 | - Implement the feature
122 | - Send a Pull Request
123 |
124 | ## License
125 |
126 | Licensed under the Apache License, Version 2.0. See LICENSE for details.
127 |
--------------------------------------------------------------------------------
/Router.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "Router"
3 | s.version = "1.0.0"
4 | s.summary = "A micro routing library written in swift, primarily for deep linking use cases."
5 | s.homepage = "https://github.com/ViacomInc/Router"
6 | s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
7 | s.author = { 'Martino Buffolino' => 'martino.buffolino@viacom.com' }
8 | s.platform = :ios, "8.0"
9 | s.source = { :git => "https://github.com/ViacomInc/Router.git", :tag => s.version }
10 | s.source_files = "Source/*.swift"
11 | s.requires_arc = true
12 |
13 | s.ios.deployment_target = '8.0'
14 |
15 | end
16 |
--------------------------------------------------------------------------------
/Router.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 16549BE8EC1DE3C02843B8E9 /* Pods_RouterTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BD11BF5AC861280FDB575872 /* Pods_RouterTests.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
11 | 818515921AE6C2CF00A26C57 /* RouterMatchingPerfTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818515911AE6C2CF00A26C57 /* RouterMatchingPerfTests.swift */; };
12 | 819D12231AE5425D0009FEA1 /* Router.h in Headers */ = {isa = PBXBuildFile; fileRef = 819D12221AE5425D0009FEA1 /* Router.h */; settings = {ATTRIBUTES = (Public, ); }; };
13 | 819D12291AE5425D0009FEA1 /* Router.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 819D121D1AE5425D0009FEA1 /* Router.framework */; };
14 | 819D12301AE5425D0009FEA1 /* RouterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819D122F1AE5425D0009FEA1 /* RouterTests.swift */; };
15 | 819D123C1AE5429A0009FEA1 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819D12391AE5429A0009FEA1 /* Router.swift */; };
16 | 819D123E1AE5429A0009FEA1 /* Route.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819D123A1AE5429A0009FEA1 /* Route.swift */; };
17 | 819D12401AE5429A0009FEA1 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819D123B1AE5429A0009FEA1 /* Request.swift */; };
18 | 819D12441AE542EE0009FEA1 /* RouterSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 819D12421AE542EE0009FEA1 /* RouterSpecs.swift */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 819D122A1AE5425D0009FEA1 /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 819D12141AE5425D0009FEA1 /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 819D121C1AE5425D0009FEA1;
27 | remoteInfo = Router;
28 | };
29 | /* End PBXContainerItemProxy section */
30 |
31 | /* Begin PBXFileReference section */
32 | 35914066E0F13072E74B0E3E /* Pods-RouterTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RouterTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RouterTests/Pods-RouterTests.release.xcconfig"; sourceTree = ""; };
33 | 818515911AE6C2CF00A26C57 /* RouterMatchingPerfTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouterMatchingPerfTests.swift; sourceTree = ""; };
34 | 819D121D1AE5425D0009FEA1 /* Router.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Router.framework; sourceTree = BUILT_PRODUCTS_DIR; };
35 | 819D12211AE5425D0009FEA1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
36 | 819D12221AE5425D0009FEA1 /* Router.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Router.h; sourceTree = ""; };
37 | 819D12281AE5425D0009FEA1 /* RouterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RouterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
38 | 819D122E1AE5425D0009FEA1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
39 | 819D122F1AE5425D0009FEA1 /* RouterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterTests.swift; sourceTree = ""; };
40 | 819D12391AE5429A0009FEA1 /* Router.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = ""; };
41 | 819D123A1AE5429A0009FEA1 /* Route.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Route.swift; sourceTree = ""; };
42 | 819D123B1AE5429A0009FEA1 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = ""; };
43 | 819D12421AE542EE0009FEA1 /* RouterSpecs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RouterSpecs.swift; sourceTree = ""; };
44 | BD11BF5AC861280FDB575872 /* Pods_RouterTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RouterTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
45 | EADA2C585F3FA4345F71981C /* Pods-RouterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RouterTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RouterTests/Pods-RouterTests.debug.xcconfig"; sourceTree = ""; };
46 | /* End PBXFileReference section */
47 |
48 | /* Begin PBXFrameworksBuildPhase section */
49 | 819D12191AE5425D0009FEA1 /* Frameworks */ = {
50 | isa = PBXFrameworksBuildPhase;
51 | buildActionMask = 2147483647;
52 | files = (
53 | );
54 | runOnlyForDeploymentPostprocessing = 0;
55 | };
56 | 819D12251AE5425D0009FEA1 /* Frameworks */ = {
57 | isa = PBXFrameworksBuildPhase;
58 | buildActionMask = 2147483647;
59 | files = (
60 | 819D12291AE5425D0009FEA1 /* Router.framework in Frameworks */,
61 | 16549BE8EC1DE3C02843B8E9 /* Pods_RouterTests.framework in Frameworks */,
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | /* End PBXFrameworksBuildPhase section */
66 |
67 | /* Begin PBXGroup section */
68 | 054DF648345FDC7AB34DA35B /* Frameworks */ = {
69 | isa = PBXGroup;
70 | children = (
71 | BD11BF5AC861280FDB575872 /* Pods_RouterTests.framework */,
72 | );
73 | name = Frameworks;
74 | sourceTree = "";
75 | };
76 | 819D12131AE5425D0009FEA1 = {
77 | isa = PBXGroup;
78 | children = (
79 | 819D121F1AE5425D0009FEA1 /* Source */,
80 | 819D122C1AE5425D0009FEA1 /* Tests */,
81 | 819D121E1AE5425D0009FEA1 /* Products */,
82 | AF6820D1DB32AFF388EA0D3E /* Pods */,
83 | 054DF648345FDC7AB34DA35B /* Frameworks */,
84 | );
85 | sourceTree = "";
86 | };
87 | 819D121E1AE5425D0009FEA1 /* Products */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 819D121D1AE5425D0009FEA1 /* Router.framework */,
91 | 819D12281AE5425D0009FEA1 /* RouterTests.xctest */,
92 | );
93 | name = Products;
94 | sourceTree = "";
95 | };
96 | 819D121F1AE5425D0009FEA1 /* Source */ = {
97 | isa = PBXGroup;
98 | children = (
99 | 819D12221AE5425D0009FEA1 /* Router.h */,
100 | 819D12391AE5429A0009FEA1 /* Router.swift */,
101 | 819D123A1AE5429A0009FEA1 /* Route.swift */,
102 | 819D123B1AE5429A0009FEA1 /* Request.swift */,
103 | 819D12201AE5425D0009FEA1 /* Supporting Files */,
104 | );
105 | path = Source;
106 | sourceTree = "";
107 | };
108 | 819D12201AE5425D0009FEA1 /* Supporting Files */ = {
109 | isa = PBXGroup;
110 | children = (
111 | 819D12211AE5425D0009FEA1 /* Info.plist */,
112 | );
113 | name = "Supporting Files";
114 | sourceTree = "";
115 | };
116 | 819D122C1AE5425D0009FEA1 /* Tests */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 819D12421AE542EE0009FEA1 /* RouterSpecs.swift */,
120 | 819D122F1AE5425D0009FEA1 /* RouterTests.swift */,
121 | 818515911AE6C2CF00A26C57 /* RouterMatchingPerfTests.swift */,
122 | 819D122D1AE5425D0009FEA1 /* Supporting Files */,
123 | );
124 | path = Tests;
125 | sourceTree = "";
126 | };
127 | 819D122D1AE5425D0009FEA1 /* Supporting Files */ = {
128 | isa = PBXGroup;
129 | children = (
130 | 819D122E1AE5425D0009FEA1 /* Info.plist */,
131 | );
132 | name = "Supporting Files";
133 | sourceTree = "";
134 | };
135 | AF6820D1DB32AFF388EA0D3E /* Pods */ = {
136 | isa = PBXGroup;
137 | children = (
138 | EADA2C585F3FA4345F71981C /* Pods-RouterTests.debug.xcconfig */,
139 | 35914066E0F13072E74B0E3E /* Pods-RouterTests.release.xcconfig */,
140 | );
141 | name = Pods;
142 | sourceTree = "";
143 | };
144 | /* End PBXGroup section */
145 |
146 | /* Begin PBXHeadersBuildPhase section */
147 | 819D121A1AE5425D0009FEA1 /* Headers */ = {
148 | isa = PBXHeadersBuildPhase;
149 | buildActionMask = 2147483647;
150 | files = (
151 | 819D12231AE5425D0009FEA1 /* Router.h in Headers */,
152 | );
153 | runOnlyForDeploymentPostprocessing = 0;
154 | };
155 | /* End PBXHeadersBuildPhase section */
156 |
157 | /* Begin PBXNativeTarget section */
158 | 819D121C1AE5425D0009FEA1 /* Router */ = {
159 | isa = PBXNativeTarget;
160 | buildConfigurationList = 819D12331AE5425D0009FEA1 /* Build configuration list for PBXNativeTarget "Router" */;
161 | buildPhases = (
162 | 819D12181AE5425D0009FEA1 /* Sources */,
163 | 819D12191AE5425D0009FEA1 /* Frameworks */,
164 | 819D121A1AE5425D0009FEA1 /* Headers */,
165 | 819D121B1AE5425D0009FEA1 /* Resources */,
166 | );
167 | buildRules = (
168 | );
169 | dependencies = (
170 | );
171 | name = Router;
172 | productName = Router;
173 | productReference = 819D121D1AE5425D0009FEA1 /* Router.framework */;
174 | productType = "com.apple.product-type.framework";
175 | };
176 | 819D12271AE5425D0009FEA1 /* RouterTests */ = {
177 | isa = PBXNativeTarget;
178 | buildConfigurationList = 819D12361AE5425D0009FEA1 /* Build configuration list for PBXNativeTarget "RouterTests" */;
179 | buildPhases = (
180 | 899FF6720097E2F8481C7C20 /* [CP] Check Pods Manifest.lock */,
181 | 819D12241AE5425D0009FEA1 /* Sources */,
182 | 819D12251AE5425D0009FEA1 /* Frameworks */,
183 | 819D12261AE5425D0009FEA1 /* Resources */,
184 | E639DA688DCEB412F61C40DD /* [CP] Embed Pods Frameworks */,
185 | 195A3B995DA6B43C80346DBA /* [CP] Copy Pods Resources */,
186 | );
187 | buildRules = (
188 | );
189 | dependencies = (
190 | 819D122B1AE5425D0009FEA1 /* PBXTargetDependency */,
191 | );
192 | name = RouterTests;
193 | productName = RouterTests;
194 | productReference = 819D12281AE5425D0009FEA1 /* RouterTests.xctest */;
195 | productType = "com.apple.product-type.bundle.unit-test";
196 | };
197 | /* End PBXNativeTarget section */
198 |
199 | /* Begin PBXProject section */
200 | 819D12141AE5425D0009FEA1 /* Project object */ = {
201 | isa = PBXProject;
202 | attributes = {
203 | LastSwiftMigration = 0700;
204 | LastSwiftUpdateCheck = 0700;
205 | LastUpgradeCheck = 0800;
206 | ORGANIZATIONNAME = "Viacom Media Network";
207 | TargetAttributes = {
208 | 819D121C1AE5425D0009FEA1 = {
209 | CreatedOnToolsVersion = 6.3;
210 | LastSwiftMigration = 0800;
211 | };
212 | 819D12271AE5425D0009FEA1 = {
213 | CreatedOnToolsVersion = 6.3;
214 | LastSwiftMigration = 0800;
215 | };
216 | };
217 | };
218 | buildConfigurationList = 819D12171AE5425D0009FEA1 /* Build configuration list for PBXProject "Router" */;
219 | compatibilityVersion = "Xcode 3.2";
220 | developmentRegion = English;
221 | hasScannedForEncodings = 0;
222 | knownRegions = (
223 | en,
224 | );
225 | mainGroup = 819D12131AE5425D0009FEA1;
226 | productRefGroup = 819D121E1AE5425D0009FEA1 /* Products */;
227 | projectDirPath = "";
228 | projectRoot = "";
229 | targets = (
230 | 819D121C1AE5425D0009FEA1 /* Router */,
231 | 819D12271AE5425D0009FEA1 /* RouterTests */,
232 | );
233 | };
234 | /* End PBXProject section */
235 |
236 | /* Begin PBXResourcesBuildPhase section */
237 | 819D121B1AE5425D0009FEA1 /* Resources */ = {
238 | isa = PBXResourcesBuildPhase;
239 | buildActionMask = 2147483647;
240 | files = (
241 | );
242 | runOnlyForDeploymentPostprocessing = 0;
243 | };
244 | 819D12261AE5425D0009FEA1 /* Resources */ = {
245 | isa = PBXResourcesBuildPhase;
246 | buildActionMask = 2147483647;
247 | files = (
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | /* End PBXResourcesBuildPhase section */
252 |
253 | /* Begin PBXShellScriptBuildPhase section */
254 | 195A3B995DA6B43C80346DBA /* [CP] Copy Pods Resources */ = {
255 | isa = PBXShellScriptBuildPhase;
256 | buildActionMask = 2147483647;
257 | files = (
258 | );
259 | inputPaths = (
260 | );
261 | name = "[CP] Copy Pods Resources";
262 | outputPaths = (
263 | );
264 | runOnlyForDeploymentPostprocessing = 0;
265 | shellPath = /bin/sh;
266 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RouterTests/Pods-RouterTests-resources.sh\"\n";
267 | showEnvVarsInLog = 0;
268 | };
269 | 899FF6720097E2F8481C7C20 /* [CP] Check Pods Manifest.lock */ = {
270 | isa = PBXShellScriptBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | );
274 | inputPaths = (
275 | );
276 | name = "[CP] Check Pods Manifest.lock";
277 | outputPaths = (
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | shellPath = /bin/sh;
281 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
282 | showEnvVarsInLog = 0;
283 | };
284 | E639DA688DCEB412F61C40DD /* [CP] Embed Pods Frameworks */ = {
285 | isa = PBXShellScriptBuildPhase;
286 | buildActionMask = 2147483647;
287 | files = (
288 | );
289 | inputPaths = (
290 | );
291 | name = "[CP] Embed Pods Frameworks";
292 | outputPaths = (
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | shellPath = /bin/sh;
296 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RouterTests/Pods-RouterTests-frameworks.sh\"\n";
297 | showEnvVarsInLog = 0;
298 | };
299 | /* End PBXShellScriptBuildPhase section */
300 |
301 | /* Begin PBXSourcesBuildPhase section */
302 | 819D12181AE5425D0009FEA1 /* Sources */ = {
303 | isa = PBXSourcesBuildPhase;
304 | buildActionMask = 2147483647;
305 | files = (
306 | 819D123C1AE5429A0009FEA1 /* Router.swift in Sources */,
307 | 819D12401AE5429A0009FEA1 /* Request.swift in Sources */,
308 | 819D123E1AE5429A0009FEA1 /* Route.swift in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | 819D12241AE5425D0009FEA1 /* Sources */ = {
313 | isa = PBXSourcesBuildPhase;
314 | buildActionMask = 2147483647;
315 | files = (
316 | 819D12441AE542EE0009FEA1 /* RouterSpecs.swift in Sources */,
317 | 818515921AE6C2CF00A26C57 /* RouterMatchingPerfTests.swift in Sources */,
318 | 819D12301AE5425D0009FEA1 /* RouterTests.swift in Sources */,
319 | );
320 | runOnlyForDeploymentPostprocessing = 0;
321 | };
322 | /* End PBXSourcesBuildPhase section */
323 |
324 | /* Begin PBXTargetDependency section */
325 | 819D122B1AE5425D0009FEA1 /* PBXTargetDependency */ = {
326 | isa = PBXTargetDependency;
327 | target = 819D121C1AE5425D0009FEA1 /* Router */;
328 | targetProxy = 819D122A1AE5425D0009FEA1 /* PBXContainerItemProxy */;
329 | };
330 | /* End PBXTargetDependency section */
331 |
332 | /* Begin XCBuildConfiguration section */
333 | 819D12311AE5425D0009FEA1 /* Debug */ = {
334 | isa = XCBuildConfiguration;
335 | buildSettings = {
336 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
337 | ALWAYS_SEARCH_USER_PATHS = NO;
338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
339 | CLANG_CXX_LIBRARY = "libc++";
340 | CLANG_ENABLE_MODULES = YES;
341 | CLANG_ENABLE_OBJC_ARC = YES;
342 | CLANG_WARN_BOOL_CONVERSION = YES;
343 | CLANG_WARN_CONSTANT_CONVERSION = YES;
344 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
345 | CLANG_WARN_EMPTY_BODY = YES;
346 | CLANG_WARN_ENUM_CONVERSION = YES;
347 | CLANG_WARN_INFINITE_RECURSION = YES;
348 | CLANG_WARN_INT_CONVERSION = YES;
349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
350 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
351 | CLANG_WARN_UNREACHABLE_CODE = YES;
352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
354 | COPY_PHASE_STRIP = NO;
355 | CURRENT_PROJECT_VERSION = 1;
356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
357 | ENABLE_STRICT_OBJC_MSGSEND = YES;
358 | ENABLE_TESTABILITY = YES;
359 | GCC_C_LANGUAGE_STANDARD = gnu99;
360 | GCC_DYNAMIC_NO_PIC = NO;
361 | GCC_NO_COMMON_BLOCKS = YES;
362 | GCC_OPTIMIZATION_LEVEL = 0;
363 | GCC_PREPROCESSOR_DEFINITIONS = (
364 | "DEBUG=1",
365 | "$(inherited)",
366 | );
367 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
368 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
369 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
370 | GCC_WARN_UNDECLARED_SELECTOR = YES;
371 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
372 | GCC_WARN_UNUSED_FUNCTION = YES;
373 | GCC_WARN_UNUSED_VARIABLE = YES;
374 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
375 | MTL_ENABLE_DEBUG_INFO = YES;
376 | ONLY_ACTIVE_ARCH = YES;
377 | SDKROOT = iphoneos;
378 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
379 | SWIFT_VERSION = 3.0;
380 | TARGETED_DEVICE_FAMILY = "1,2";
381 | VERSIONING_SYSTEM = "apple-generic";
382 | VERSION_INFO_PREFIX = "";
383 | };
384 | name = Debug;
385 | };
386 | 819D12321AE5425D0009FEA1 /* Release */ = {
387 | isa = XCBuildConfiguration;
388 | buildSettings = {
389 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
390 | ALWAYS_SEARCH_USER_PATHS = NO;
391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
392 | CLANG_CXX_LIBRARY = "libc++";
393 | CLANG_ENABLE_MODULES = YES;
394 | CLANG_ENABLE_OBJC_ARC = YES;
395 | CLANG_WARN_BOOL_CONVERSION = YES;
396 | CLANG_WARN_CONSTANT_CONVERSION = YES;
397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
398 | CLANG_WARN_EMPTY_BODY = YES;
399 | CLANG_WARN_ENUM_CONVERSION = YES;
400 | CLANG_WARN_INFINITE_RECURSION = YES;
401 | CLANG_WARN_INT_CONVERSION = YES;
402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
403 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
404 | CLANG_WARN_UNREACHABLE_CODE = YES;
405 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
407 | COPY_PHASE_STRIP = NO;
408 | CURRENT_PROJECT_VERSION = 1;
409 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
410 | ENABLE_NS_ASSERTIONS = NO;
411 | ENABLE_STRICT_OBJC_MSGSEND = YES;
412 | GCC_C_LANGUAGE_STANDARD = gnu99;
413 | GCC_NO_COMMON_BLOCKS = YES;
414 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
415 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
416 | GCC_WARN_UNDECLARED_SELECTOR = YES;
417 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
418 | GCC_WARN_UNUSED_FUNCTION = YES;
419 | GCC_WARN_UNUSED_VARIABLE = YES;
420 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
421 | MTL_ENABLE_DEBUG_INFO = NO;
422 | SDKROOT = iphoneos;
423 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
424 | SWIFT_VERSION = 3.0;
425 | TARGETED_DEVICE_FAMILY = "1,2";
426 | VALIDATE_PRODUCT = YES;
427 | VERSIONING_SYSTEM = "apple-generic";
428 | VERSION_INFO_PREFIX = "";
429 | };
430 | name = Release;
431 | };
432 | 819D12341AE5425D0009FEA1 /* Debug */ = {
433 | isa = XCBuildConfiguration;
434 | buildSettings = {
435 | CLANG_ENABLE_MODULES = YES;
436 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
437 | DEFINES_MODULE = YES;
438 | DYLIB_COMPATIBILITY_VERSION = 1;
439 | DYLIB_CURRENT_VERSION = 1;
440 | DYLIB_INSTALL_NAME_BASE = "@rpath";
441 | INFOPLIST_FILE = Source/Info.plist;
442 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
443 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
444 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
445 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
446 | PRODUCT_NAME = "$(TARGET_NAME)";
447 | SKIP_INSTALL = YES;
448 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
449 | SWIFT_VERSION = 3.0;
450 | };
451 | name = Debug;
452 | };
453 | 819D12351AE5425D0009FEA1 /* Release */ = {
454 | isa = XCBuildConfiguration;
455 | buildSettings = {
456 | CLANG_ENABLE_MODULES = YES;
457 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
458 | DEFINES_MODULE = YES;
459 | DYLIB_COMPATIBILITY_VERSION = 1;
460 | DYLIB_CURRENT_VERSION = 1;
461 | DYLIB_INSTALL_NAME_BASE = "@rpath";
462 | INFOPLIST_FILE = Source/Info.plist;
463 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
464 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
465 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
466 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
467 | PRODUCT_NAME = "$(TARGET_NAME)";
468 | SKIP_INSTALL = YES;
469 | SWIFT_VERSION = 3.0;
470 | };
471 | name = Release;
472 | };
473 | 819D12371AE5425D0009FEA1 /* Debug */ = {
474 | isa = XCBuildConfiguration;
475 | baseConfigurationReference = EADA2C585F3FA4345F71981C /* Pods-RouterTests.debug.xcconfig */;
476 | buildSettings = {
477 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
478 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
479 | GCC_PREPROCESSOR_DEFINITIONS = (
480 | "DEBUG=1",
481 | "$(inherited)",
482 | );
483 | INFOPLIST_FILE = Tests/Info.plist;
484 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
485 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
486 | PRODUCT_NAME = "$(TARGET_NAME)";
487 | SWIFT_VERSION = 3.0;
488 | };
489 | name = Debug;
490 | };
491 | 819D12381AE5425D0009FEA1 /* Release */ = {
492 | isa = XCBuildConfiguration;
493 | baseConfigurationReference = 35914066E0F13072E74B0E3E /* Pods-RouterTests.release.xcconfig */;
494 | buildSettings = {
495 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
496 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
497 | INFOPLIST_FILE = Tests/Info.plist;
498 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
499 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
500 | PRODUCT_NAME = "$(TARGET_NAME)";
501 | SWIFT_VERSION = 3.0;
502 | };
503 | name = Release;
504 | };
505 | /* End XCBuildConfiguration section */
506 |
507 | /* Begin XCConfigurationList section */
508 | 819D12171AE5425D0009FEA1 /* Build configuration list for PBXProject "Router" */ = {
509 | isa = XCConfigurationList;
510 | buildConfigurations = (
511 | 819D12311AE5425D0009FEA1 /* Debug */,
512 | 819D12321AE5425D0009FEA1 /* Release */,
513 | );
514 | defaultConfigurationIsVisible = 0;
515 | defaultConfigurationName = Release;
516 | };
517 | 819D12331AE5425D0009FEA1 /* Build configuration list for PBXNativeTarget "Router" */ = {
518 | isa = XCConfigurationList;
519 | buildConfigurations = (
520 | 819D12341AE5425D0009FEA1 /* Debug */,
521 | 819D12351AE5425D0009FEA1 /* Release */,
522 | );
523 | defaultConfigurationIsVisible = 0;
524 | defaultConfigurationName = Release;
525 | };
526 | 819D12361AE5425D0009FEA1 /* Build configuration list for PBXNativeTarget "RouterTests" */ = {
527 | isa = XCConfigurationList;
528 | buildConfigurations = (
529 | 819D12371AE5425D0009FEA1 /* Debug */,
530 | 819D12381AE5425D0009FEA1 /* Release */,
531 | );
532 | defaultConfigurationIsVisible = 0;
533 | defaultConfigurationName = Release;
534 | };
535 | /* End XCConfigurationList section */
536 | };
537 | rootObject = 819D12141AE5425D0009FEA1 /* Project object */;
538 | }
539 |
--------------------------------------------------------------------------------
/Router.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Router.xcodeproj/xcshareddata/xcbaselines/819D12271AE5425D0009FEA1.xcbaseline/EF97FBB9-9A2F-4C5E-B37D-748417F5274D.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | classNames
6 |
7 | RouterMatchingPerfTests
8 |
9 | testPerformanceExample()
10 |
11 | com.apple.XCTPerformanceMetric_WallClockTime
12 |
13 | baselineAverage
14 | 0.05
15 | baselineIntegrationDisplayName
16 | Local Baseline
17 |
18 |
19 |
20 | RouterTests
21 |
22 | testPerformanceExample()
23 |
24 | com.apple.XCTPerformanceMetric_WallClockTime
25 |
26 | baselineAverage
27 | 0.33
28 | baselineIntegrationDisplayName
29 | Local Baseline
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Router.xcodeproj/xcshareddata/xcbaselines/819D12271AE5425D0009FEA1.xcbaseline/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | runDestinationsByUUID
6 |
7 | EF97FBB9-9A2F-4C5E-B37D-748417F5274D
8 |
9 | localComputer
10 |
11 | busSpeedInMHz
12 | 100
13 | cpuCount
14 | 1
15 | cpuKind
16 | Intel Core i7
17 | cpuSpeedInMHz
18 | 2700
19 | logicalCPUCoresPerPackage
20 | 8
21 | modelCode
22 | MacBookPro10,1
23 | physicalCPUCoresPerPackage
24 | 4
25 | platformIdentifier
26 | com.apple.platform.macosx
27 |
28 | targetArchitecture
29 | x86_64
30 | targetDevice
31 |
32 | modelCode
33 | iPhone7,2
34 | platformIdentifier
35 | com.apple.platform.iphonesimulator
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Router.xcodeproj/xcshareddata/xcschemes/Router.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
67 |
68 |
78 |
79 |
85 |
86 |
87 |
88 |
89 |
90 |
96 |
97 |
103 |
104 |
105 |
106 |
108 |
109 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/Router.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/RouterExample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 812463021AE54607005959E5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812463011AE54607005959E5 /* AppDelegate.swift */; };
11 | 812463041AE54607005959E5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812463031AE54607005959E5 /* ViewController.swift */; };
12 | 812463071AE54607005959E5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 812463051AE54607005959E5 /* Main.storyboard */; };
13 | 812463091AE54607005959E5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 812463081AE54607005959E5 /* Images.xcassets */; };
14 | 8124630C1AE54607005959E5 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8124630A1AE54607005959E5 /* LaunchScreen.xib */; };
15 | 812463181AE54607005959E5 /* RouterExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812463171AE54607005959E5 /* RouterExampleTests.swift */; };
16 | 812463311AE5484D005959E5 /* Router.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812463271AE546C4005959E5 /* Router.framework */; };
17 | 812463321AE5484D005959E5 /* Router.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812463271AE546C4005959E5 /* Router.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18 | 8185158D1AE6AB4300A26C57 /* MyRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8185158C1AE6AB4300A26C57 /* MyRootViewController.swift */; };
19 | 81F7B2551AE57D9500DEB24F /* ExampleSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81F7B2541AE57D9500DEB24F /* ExampleSpec.swift */; };
20 | 8A9DE3FE049B9274DB7C1BEF /* Pods_RouterExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C003CCB074FC3959BC880D2 /* Pods_RouterExampleTests.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXContainerItemProxy section */
24 | 812463121AE54607005959E5 /* PBXContainerItemProxy */ = {
25 | isa = PBXContainerItemProxy;
26 | containerPortal = 812462F41AE54607005959E5 /* Project object */;
27 | proxyType = 1;
28 | remoteGlobalIDString = 812462FB1AE54607005959E5;
29 | remoteInfo = RouterExample;
30 | };
31 | 812463261AE546C4005959E5 /* PBXContainerItemProxy */ = {
32 | isa = PBXContainerItemProxy;
33 | containerPortal = 812463211AE546C4005959E5 /* Router.xcodeproj */;
34 | proxyType = 2;
35 | remoteGlobalIDString = 819D121D1AE5425D0009FEA1;
36 | remoteInfo = Router;
37 | };
38 | 812463281AE546C4005959E5 /* PBXContainerItemProxy */ = {
39 | isa = PBXContainerItemProxy;
40 | containerPortal = 812463211AE546C4005959E5 /* Router.xcodeproj */;
41 | proxyType = 2;
42 | remoteGlobalIDString = 819D12281AE5425D0009FEA1;
43 | remoteInfo = RouterTests;
44 | };
45 | 812463331AE5484D005959E5 /* PBXContainerItemProxy */ = {
46 | isa = PBXContainerItemProxy;
47 | containerPortal = 812463211AE546C4005959E5 /* Router.xcodeproj */;
48 | proxyType = 1;
49 | remoteGlobalIDString = 819D121C1AE5425D0009FEA1;
50 | remoteInfo = Router;
51 | };
52 | /* End PBXContainerItemProxy section */
53 |
54 | /* Begin PBXCopyFilesBuildPhase section */
55 | 812463351AE5484D005959E5 /* Embed Frameworks */ = {
56 | isa = PBXCopyFilesBuildPhase;
57 | buildActionMask = 2147483647;
58 | dstPath = "";
59 | dstSubfolderSpec = 10;
60 | files = (
61 | 812463321AE5484D005959E5 /* Router.framework in Embed Frameworks */,
62 | );
63 | name = "Embed Frameworks";
64 | runOnlyForDeploymentPostprocessing = 0;
65 | };
66 | /* End PBXCopyFilesBuildPhase section */
67 |
68 | /* Begin PBXFileReference section */
69 | 1BE17E62659A3CF4E0014046 /* Pods-RouterExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RouterExampleTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RouterExampleTests/Pods-RouterExampleTests.debug.xcconfig"; sourceTree = ""; };
70 | 1C003CCB074FC3959BC880D2 /* Pods_RouterExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RouterExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
71 | 812462FC1AE54607005959E5 /* RouterExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RouterExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
72 | 812463001AE54607005959E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
73 | 812463011AE54607005959E5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
74 | 812463031AE54607005959E5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
75 | 812463061AE54607005959E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
76 | 812463081AE54607005959E5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
77 | 8124630B1AE54607005959E5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
78 | 812463111AE54607005959E5 /* RouterExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RouterExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
79 | 812463161AE54607005959E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
80 | 812463171AE54607005959E5 /* RouterExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterExampleTests.swift; sourceTree = ""; };
81 | 812463211AE546C4005959E5 /* Router.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Router.xcodeproj; sourceTree = ""; };
82 | 8185158C1AE6AB4300A26C57 /* MyRootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyRootViewController.swift; sourceTree = ""; };
83 | 81F7B2541AE57D9500DEB24F /* ExampleSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleSpec.swift; sourceTree = ""; };
84 | C3CD6FC39BD3F9A6817CEE22 /* Pods-RouterExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RouterExampleTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RouterExampleTests/Pods-RouterExampleTests.release.xcconfig"; sourceTree = ""; };
85 | /* End PBXFileReference section */
86 |
87 | /* Begin PBXFrameworksBuildPhase section */
88 | 812462F91AE54607005959E5 /* Frameworks */ = {
89 | isa = PBXFrameworksBuildPhase;
90 | buildActionMask = 2147483647;
91 | files = (
92 | 812463311AE5484D005959E5 /* Router.framework in Frameworks */,
93 | );
94 | runOnlyForDeploymentPostprocessing = 0;
95 | };
96 | 8124630E1AE54607005959E5 /* Frameworks */ = {
97 | isa = PBXFrameworksBuildPhase;
98 | buildActionMask = 2147483647;
99 | files = (
100 | 8A9DE3FE049B9274DB7C1BEF /* Pods_RouterExampleTests.framework in Frameworks */,
101 | );
102 | runOnlyForDeploymentPostprocessing = 0;
103 | };
104 | /* End PBXFrameworksBuildPhase section */
105 |
106 | /* Begin PBXGroup section */
107 | 812462F31AE54607005959E5 = {
108 | isa = PBXGroup;
109 | children = (
110 | 812462FE1AE54607005959E5 /* Example */,
111 | 812463141AE54607005959E5 /* Integration */,
112 | 812462FD1AE54607005959E5 /* Products */,
113 | 812463211AE546C4005959E5 /* Router.xcodeproj */,
114 | AE0DD895E533CAD9AB109A65 /* Pods */,
115 | B1C8613DEFE29FBEFFE27661 /* Frameworks */,
116 | );
117 | sourceTree = "";
118 | };
119 | 812462FD1AE54607005959E5 /* Products */ = {
120 | isa = PBXGroup;
121 | children = (
122 | 812462FC1AE54607005959E5 /* RouterExample.app */,
123 | 812463111AE54607005959E5 /* RouterExampleTests.xctest */,
124 | );
125 | name = Products;
126 | sourceTree = "";
127 | };
128 | 812462FE1AE54607005959E5 /* Example */ = {
129 | isa = PBXGroup;
130 | children = (
131 | 812463011AE54607005959E5 /* AppDelegate.swift */,
132 | 812463031AE54607005959E5 /* ViewController.swift */,
133 | 8185158C1AE6AB4300A26C57 /* MyRootViewController.swift */,
134 | 812463051AE54607005959E5 /* Main.storyboard */,
135 | 812463081AE54607005959E5 /* Images.xcassets */,
136 | 8124630A1AE54607005959E5 /* LaunchScreen.xib */,
137 | 812462FF1AE54607005959E5 /* Supporting Files */,
138 | );
139 | path = Example;
140 | sourceTree = "";
141 | };
142 | 812462FF1AE54607005959E5 /* Supporting Files */ = {
143 | isa = PBXGroup;
144 | children = (
145 | 812463001AE54607005959E5 /* Info.plist */,
146 | );
147 | name = "Supporting Files";
148 | sourceTree = "";
149 | };
150 | 812463141AE54607005959E5 /* Integration */ = {
151 | isa = PBXGroup;
152 | children = (
153 | 812463171AE54607005959E5 /* RouterExampleTests.swift */,
154 | 81F7B2541AE57D9500DEB24F /* ExampleSpec.swift */,
155 | 812463151AE54607005959E5 /* Supporting Files */,
156 | );
157 | path = Integration;
158 | sourceTree = "";
159 | };
160 | 812463151AE54607005959E5 /* Supporting Files */ = {
161 | isa = PBXGroup;
162 | children = (
163 | 812463161AE54607005959E5 /* Info.plist */,
164 | );
165 | name = "Supporting Files";
166 | sourceTree = "";
167 | };
168 | 812463221AE546C4005959E5 /* Products */ = {
169 | isa = PBXGroup;
170 | children = (
171 | 812463271AE546C4005959E5 /* Router.framework */,
172 | 812463291AE546C4005959E5 /* RouterTests.xctest */,
173 | );
174 | name = Products;
175 | sourceTree = "";
176 | };
177 | AE0DD895E533CAD9AB109A65 /* Pods */ = {
178 | isa = PBXGroup;
179 | children = (
180 | 1BE17E62659A3CF4E0014046 /* Pods-RouterExampleTests.debug.xcconfig */,
181 | C3CD6FC39BD3F9A6817CEE22 /* Pods-RouterExampleTests.release.xcconfig */,
182 | );
183 | name = Pods;
184 | sourceTree = "";
185 | };
186 | B1C8613DEFE29FBEFFE27661 /* Frameworks */ = {
187 | isa = PBXGroup;
188 | children = (
189 | 1C003CCB074FC3959BC880D2 /* Pods_RouterExampleTests.framework */,
190 | );
191 | name = Frameworks;
192 | sourceTree = "";
193 | };
194 | /* End PBXGroup section */
195 |
196 | /* Begin PBXNativeTarget section */
197 | 812462FB1AE54607005959E5 /* RouterExample */ = {
198 | isa = PBXNativeTarget;
199 | buildConfigurationList = 8124631B1AE54607005959E5 /* Build configuration list for PBXNativeTarget "RouterExample" */;
200 | buildPhases = (
201 | 812462F81AE54607005959E5 /* Sources */,
202 | 812462F91AE54607005959E5 /* Frameworks */,
203 | 812462FA1AE54607005959E5 /* Resources */,
204 | 812463351AE5484D005959E5 /* Embed Frameworks */,
205 | );
206 | buildRules = (
207 | );
208 | dependencies = (
209 | 812463341AE5484D005959E5 /* PBXTargetDependency */,
210 | );
211 | name = RouterExample;
212 | productName = RouterExample;
213 | productReference = 812462FC1AE54607005959E5 /* RouterExample.app */;
214 | productType = "com.apple.product-type.application";
215 | };
216 | 812463101AE54607005959E5 /* RouterExampleTests */ = {
217 | isa = PBXNativeTarget;
218 | buildConfigurationList = 8124631E1AE54607005959E5 /* Build configuration list for PBXNativeTarget "RouterExampleTests" */;
219 | buildPhases = (
220 | 1C86FF2789DCBF4E1BE75156 /* [CP] Check Pods Manifest.lock */,
221 | 8124630D1AE54607005959E5 /* Sources */,
222 | 8124630E1AE54607005959E5 /* Frameworks */,
223 | 8124630F1AE54607005959E5 /* Resources */,
224 | 817395ACBA7983AAF0EE26DE /* [CP] Embed Pods Frameworks */,
225 | 49FA03BA406F665B6E1B30EC /* [CP] Copy Pods Resources */,
226 | );
227 | buildRules = (
228 | );
229 | dependencies = (
230 | 812463131AE54607005959E5 /* PBXTargetDependency */,
231 | );
232 | name = RouterExampleTests;
233 | productName = RouterExampleTests;
234 | productReference = 812463111AE54607005959E5 /* RouterExampleTests.xctest */;
235 | productType = "com.apple.product-type.bundle.unit-test";
236 | };
237 | /* End PBXNativeTarget section */
238 |
239 | /* Begin PBXProject section */
240 | 812462F41AE54607005959E5 /* Project object */ = {
241 | isa = PBXProject;
242 | attributes = {
243 | LastSwiftUpdateCheck = 0700;
244 | LastUpgradeCheck = 0800;
245 | ORGANIZATIONNAME = "Viacom Media Network";
246 | TargetAttributes = {
247 | 812462FB1AE54607005959E5 = {
248 | CreatedOnToolsVersion = 6.3;
249 | DevelopmentTeam = 4FYKNX9T4Z;
250 | };
251 | 812463101AE54607005959E5 = {
252 | CreatedOnToolsVersion = 6.3;
253 | TestTargetID = 812462FB1AE54607005959E5;
254 | };
255 | };
256 | };
257 | buildConfigurationList = 812462F71AE54607005959E5 /* Build configuration list for PBXProject "RouterExample" */;
258 | compatibilityVersion = "Xcode 3.2";
259 | developmentRegion = English;
260 | hasScannedForEncodings = 0;
261 | knownRegions = (
262 | en,
263 | Base,
264 | );
265 | mainGroup = 812462F31AE54607005959E5;
266 | productRefGroup = 812462FD1AE54607005959E5 /* Products */;
267 | projectDirPath = "";
268 | projectReferences = (
269 | {
270 | ProductGroup = 812463221AE546C4005959E5 /* Products */;
271 | ProjectRef = 812463211AE546C4005959E5 /* Router.xcodeproj */;
272 | },
273 | );
274 | projectRoot = "";
275 | targets = (
276 | 812462FB1AE54607005959E5 /* RouterExample */,
277 | 812463101AE54607005959E5 /* RouterExampleTests */,
278 | );
279 | };
280 | /* End PBXProject section */
281 |
282 | /* Begin PBXReferenceProxy section */
283 | 812463271AE546C4005959E5 /* Router.framework */ = {
284 | isa = PBXReferenceProxy;
285 | fileType = wrapper.framework;
286 | path = Router.framework;
287 | remoteRef = 812463261AE546C4005959E5 /* PBXContainerItemProxy */;
288 | sourceTree = BUILT_PRODUCTS_DIR;
289 | };
290 | 812463291AE546C4005959E5 /* RouterTests.xctest */ = {
291 | isa = PBXReferenceProxy;
292 | fileType = wrapper.cfbundle;
293 | path = RouterTests.xctest;
294 | remoteRef = 812463281AE546C4005959E5 /* PBXContainerItemProxy */;
295 | sourceTree = BUILT_PRODUCTS_DIR;
296 | };
297 | /* End PBXReferenceProxy section */
298 |
299 | /* Begin PBXResourcesBuildPhase section */
300 | 812462FA1AE54607005959E5 /* Resources */ = {
301 | isa = PBXResourcesBuildPhase;
302 | buildActionMask = 2147483647;
303 | files = (
304 | 812463071AE54607005959E5 /* Main.storyboard in Resources */,
305 | 8124630C1AE54607005959E5 /* LaunchScreen.xib in Resources */,
306 | 812463091AE54607005959E5 /* Images.xcassets in Resources */,
307 | );
308 | runOnlyForDeploymentPostprocessing = 0;
309 | };
310 | 8124630F1AE54607005959E5 /* Resources */ = {
311 | isa = PBXResourcesBuildPhase;
312 | buildActionMask = 2147483647;
313 | files = (
314 | );
315 | runOnlyForDeploymentPostprocessing = 0;
316 | };
317 | /* End PBXResourcesBuildPhase section */
318 |
319 | /* Begin PBXShellScriptBuildPhase section */
320 | 1C86FF2789DCBF4E1BE75156 /* [CP] Check Pods Manifest.lock */ = {
321 | isa = PBXShellScriptBuildPhase;
322 | buildActionMask = 2147483647;
323 | files = (
324 | );
325 | inputPaths = (
326 | );
327 | name = "[CP] Check Pods Manifest.lock";
328 | outputPaths = (
329 | );
330 | runOnlyForDeploymentPostprocessing = 0;
331 | shellPath = /bin/sh;
332 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
333 | showEnvVarsInLog = 0;
334 | };
335 | 49FA03BA406F665B6E1B30EC /* [CP] Copy Pods Resources */ = {
336 | isa = PBXShellScriptBuildPhase;
337 | buildActionMask = 2147483647;
338 | files = (
339 | );
340 | inputPaths = (
341 | );
342 | name = "[CP] Copy Pods Resources";
343 | outputPaths = (
344 | );
345 | runOnlyForDeploymentPostprocessing = 0;
346 | shellPath = /bin/sh;
347 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RouterExampleTests/Pods-RouterExampleTests-resources.sh\"\n";
348 | showEnvVarsInLog = 0;
349 | };
350 | 817395ACBA7983AAF0EE26DE /* [CP] Embed Pods Frameworks */ = {
351 | isa = PBXShellScriptBuildPhase;
352 | buildActionMask = 2147483647;
353 | files = (
354 | );
355 | inputPaths = (
356 | );
357 | name = "[CP] Embed Pods Frameworks";
358 | outputPaths = (
359 | );
360 | runOnlyForDeploymentPostprocessing = 0;
361 | shellPath = /bin/sh;
362 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RouterExampleTests/Pods-RouterExampleTests-frameworks.sh\"\n";
363 | showEnvVarsInLog = 0;
364 | };
365 | /* End PBXShellScriptBuildPhase section */
366 |
367 | /* Begin PBXSourcesBuildPhase section */
368 | 812462F81AE54607005959E5 /* Sources */ = {
369 | isa = PBXSourcesBuildPhase;
370 | buildActionMask = 2147483647;
371 | files = (
372 | 812463041AE54607005959E5 /* ViewController.swift in Sources */,
373 | 812463021AE54607005959E5 /* AppDelegate.swift in Sources */,
374 | 8185158D1AE6AB4300A26C57 /* MyRootViewController.swift in Sources */,
375 | );
376 | runOnlyForDeploymentPostprocessing = 0;
377 | };
378 | 8124630D1AE54607005959E5 /* Sources */ = {
379 | isa = PBXSourcesBuildPhase;
380 | buildActionMask = 2147483647;
381 | files = (
382 | 812463181AE54607005959E5 /* RouterExampleTests.swift in Sources */,
383 | 81F7B2551AE57D9500DEB24F /* ExampleSpec.swift in Sources */,
384 | );
385 | runOnlyForDeploymentPostprocessing = 0;
386 | };
387 | /* End PBXSourcesBuildPhase section */
388 |
389 | /* Begin PBXTargetDependency section */
390 | 812463131AE54607005959E5 /* PBXTargetDependency */ = {
391 | isa = PBXTargetDependency;
392 | target = 812462FB1AE54607005959E5 /* RouterExample */;
393 | targetProxy = 812463121AE54607005959E5 /* PBXContainerItemProxy */;
394 | };
395 | 812463341AE5484D005959E5 /* PBXTargetDependency */ = {
396 | isa = PBXTargetDependency;
397 | name = Router;
398 | targetProxy = 812463331AE5484D005959E5 /* PBXContainerItemProxy */;
399 | };
400 | /* End PBXTargetDependency section */
401 |
402 | /* Begin PBXVariantGroup section */
403 | 812463051AE54607005959E5 /* Main.storyboard */ = {
404 | isa = PBXVariantGroup;
405 | children = (
406 | 812463061AE54607005959E5 /* Base */,
407 | );
408 | name = Main.storyboard;
409 | sourceTree = "";
410 | };
411 | 8124630A1AE54607005959E5 /* LaunchScreen.xib */ = {
412 | isa = PBXVariantGroup;
413 | children = (
414 | 8124630B1AE54607005959E5 /* Base */,
415 | );
416 | name = LaunchScreen.xib;
417 | sourceTree = "";
418 | };
419 | /* End PBXVariantGroup section */
420 |
421 | /* Begin XCBuildConfiguration section */
422 | 812463191AE54607005959E5 /* Debug */ = {
423 | isa = XCBuildConfiguration;
424 | buildSettings = {
425 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
426 | ALWAYS_SEARCH_USER_PATHS = NO;
427 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
428 | CLANG_CXX_LIBRARY = "libc++";
429 | CLANG_ENABLE_MODULES = YES;
430 | CLANG_ENABLE_OBJC_ARC = YES;
431 | CLANG_WARN_BOOL_CONVERSION = YES;
432 | CLANG_WARN_CONSTANT_CONVERSION = YES;
433 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
434 | CLANG_WARN_EMPTY_BODY = YES;
435 | CLANG_WARN_ENUM_CONVERSION = YES;
436 | CLANG_WARN_INFINITE_RECURSION = YES;
437 | CLANG_WARN_INT_CONVERSION = YES;
438 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
439 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
440 | CLANG_WARN_UNREACHABLE_CODE = YES;
441 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
442 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
443 | COPY_PHASE_STRIP = NO;
444 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
445 | ENABLE_STRICT_OBJC_MSGSEND = YES;
446 | ENABLE_TESTABILITY = YES;
447 | GCC_C_LANGUAGE_STANDARD = gnu99;
448 | GCC_DYNAMIC_NO_PIC = NO;
449 | GCC_NO_COMMON_BLOCKS = YES;
450 | GCC_OPTIMIZATION_LEVEL = 0;
451 | GCC_PREPROCESSOR_DEFINITIONS = (
452 | "DEBUG=1",
453 | "$(inherited)",
454 | );
455 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
456 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
457 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
458 | GCC_WARN_UNDECLARED_SELECTOR = YES;
459 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
460 | GCC_WARN_UNUSED_FUNCTION = YES;
461 | GCC_WARN_UNUSED_VARIABLE = YES;
462 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
463 | MTL_ENABLE_DEBUG_INFO = YES;
464 | ONLY_ACTIVE_ARCH = YES;
465 | SDKROOT = iphoneos;
466 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
467 | SWIFT_VERSION = 3.0;
468 | TARGETED_DEVICE_FAMILY = "1,2";
469 | };
470 | name = Debug;
471 | };
472 | 8124631A1AE54607005959E5 /* Release */ = {
473 | isa = XCBuildConfiguration;
474 | buildSettings = {
475 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
476 | ALWAYS_SEARCH_USER_PATHS = NO;
477 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
478 | CLANG_CXX_LIBRARY = "libc++";
479 | CLANG_ENABLE_MODULES = YES;
480 | CLANG_ENABLE_OBJC_ARC = YES;
481 | CLANG_WARN_BOOL_CONVERSION = YES;
482 | CLANG_WARN_CONSTANT_CONVERSION = YES;
483 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
484 | CLANG_WARN_EMPTY_BODY = YES;
485 | CLANG_WARN_ENUM_CONVERSION = YES;
486 | CLANG_WARN_INFINITE_RECURSION = YES;
487 | CLANG_WARN_INT_CONVERSION = YES;
488 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
489 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
490 | CLANG_WARN_UNREACHABLE_CODE = YES;
491 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
492 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
493 | COPY_PHASE_STRIP = NO;
494 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
495 | ENABLE_NS_ASSERTIONS = NO;
496 | ENABLE_STRICT_OBJC_MSGSEND = YES;
497 | GCC_C_LANGUAGE_STANDARD = gnu99;
498 | GCC_NO_COMMON_BLOCKS = YES;
499 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
500 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
501 | GCC_WARN_UNDECLARED_SELECTOR = YES;
502 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
503 | GCC_WARN_UNUSED_FUNCTION = YES;
504 | GCC_WARN_UNUSED_VARIABLE = YES;
505 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
506 | MTL_ENABLE_DEBUG_INFO = NO;
507 | SDKROOT = iphoneos;
508 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
509 | SWIFT_VERSION = 3.0;
510 | TARGETED_DEVICE_FAMILY = "1,2";
511 | VALIDATE_PRODUCT = YES;
512 | };
513 | name = Release;
514 | };
515 | 8124631C1AE54607005959E5 /* Debug */ = {
516 | isa = XCBuildConfiguration;
517 | buildSettings = {
518 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
519 | CODE_SIGN_IDENTITY = "iPhone Developer";
520 | INFOPLIST_FILE = Example/Info.plist;
521 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
523 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
524 | PRODUCT_NAME = "$(TARGET_NAME)";
525 | };
526 | name = Debug;
527 | };
528 | 8124631D1AE54607005959E5 /* Release */ = {
529 | isa = XCBuildConfiguration;
530 | buildSettings = {
531 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
532 | CODE_SIGN_IDENTITY = "iPhone Developer";
533 | INFOPLIST_FILE = Example/Info.plist;
534 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
535 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
536 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
537 | PRODUCT_NAME = "$(TARGET_NAME)";
538 | };
539 | name = Release;
540 | };
541 | 8124631F1AE54607005959E5 /* Debug */ = {
542 | isa = XCBuildConfiguration;
543 | baseConfigurationReference = 1BE17E62659A3CF4E0014046 /* Pods-RouterExampleTests.debug.xcconfig */;
544 | buildSettings = {
545 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
546 | BUNDLE_LOADER = "$(TEST_HOST)";
547 | FRAMEWORK_SEARCH_PATHS = (
548 | "$(SDKROOT)/Developer/Library/Frameworks",
549 | "$(inherited)",
550 | "$(PROJECT_DIR)/build/Debug-iphoneos",
551 | );
552 | GCC_PREPROCESSOR_DEFINITIONS = (
553 | "DEBUG=1",
554 | "$(inherited)",
555 | );
556 | INFOPLIST_FILE = Integration/Info.plist;
557 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
558 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
559 | PRODUCT_NAME = "$(TARGET_NAME)";
560 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RouterExample.app/RouterExample";
561 | };
562 | name = Debug;
563 | };
564 | 812463201AE54607005959E5 /* Release */ = {
565 | isa = XCBuildConfiguration;
566 | baseConfigurationReference = C3CD6FC39BD3F9A6817CEE22 /* Pods-RouterExampleTests.release.xcconfig */;
567 | buildSettings = {
568 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
569 | BUNDLE_LOADER = "$(TEST_HOST)";
570 | FRAMEWORK_SEARCH_PATHS = (
571 | "$(SDKROOT)/Developer/Library/Frameworks",
572 | "$(inherited)",
573 | "$(PROJECT_DIR)/build/Debug-iphoneos",
574 | );
575 | INFOPLIST_FILE = Integration/Info.plist;
576 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
577 | PRODUCT_BUNDLE_IDENTIFIER = "com.viacom.$(PRODUCT_NAME:rfc1034identifier)";
578 | PRODUCT_NAME = "$(TARGET_NAME)";
579 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RouterExample.app/RouterExample";
580 | };
581 | name = Release;
582 | };
583 | /* End XCBuildConfiguration section */
584 |
585 | /* Begin XCConfigurationList section */
586 | 812462F71AE54607005959E5 /* Build configuration list for PBXProject "RouterExample" */ = {
587 | isa = XCConfigurationList;
588 | buildConfigurations = (
589 | 812463191AE54607005959E5 /* Debug */,
590 | 8124631A1AE54607005959E5 /* Release */,
591 | );
592 | defaultConfigurationIsVisible = 0;
593 | defaultConfigurationName = Release;
594 | };
595 | 8124631B1AE54607005959E5 /* Build configuration list for PBXNativeTarget "RouterExample" */ = {
596 | isa = XCConfigurationList;
597 | buildConfigurations = (
598 | 8124631C1AE54607005959E5 /* Debug */,
599 | 8124631D1AE54607005959E5 /* Release */,
600 | );
601 | defaultConfigurationIsVisible = 0;
602 | defaultConfigurationName = Release;
603 | };
604 | 8124631E1AE54607005959E5 /* Build configuration list for PBXNativeTarget "RouterExampleTests" */ = {
605 | isa = XCConfigurationList;
606 | buildConfigurations = (
607 | 8124631F1AE54607005959E5 /* Debug */,
608 | 812463201AE54607005959E5 /* Release */,
609 | );
610 | defaultConfigurationIsVisible = 0;
611 | defaultConfigurationName = Release;
612 | };
613 | /* End XCConfigurationList section */
614 | };
615 | rootObject = 812462F41AE54607005959E5 /* Project object */;
616 | }
617 |
--------------------------------------------------------------------------------
/RouterExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/Source/Request.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 |
19 | open class Request {
20 |
21 | open let route: Route
22 |
23 | fileprivate var urlParams = [String: String]()
24 | fileprivate var queryParams = [String: String]()
25 |
26 | init(aRoute: Route, urlParams: [URLQueryItem], queryParams: [URLQueryItem]?) {
27 | route = aRoute
28 | for param in urlParams {
29 | if let value = param.value {
30 | self.urlParams[param.name] = value
31 | }
32 | }
33 |
34 | guard let queryParams = queryParams else { return }
35 | for param in queryParams {
36 | if let value = param.value {
37 | self.queryParams[param.name] = value
38 | }
39 | }
40 | }
41 |
42 | /**
43 | Acessing url params in the route, ie. id from /video/:id
44 |
45 | - parameter name: Key of the param
46 | - returns: value of the the param
47 | */
48 | open func param(_ name: String) -> String? {
49 | return urlParams[name]
50 | }
51 |
52 | /**
53 | Acessing query strings params in the route, ie q from /video?q=asdf
54 |
55 | - parameter name: Key of the param
56 | - returns: value of the the param
57 | */
58 | open func query(_ name: String) -> String? {
59 | return queryParams[name]
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/Source/Route.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 |
19 | open class Route {
20 |
21 | enum Pattern: String {
22 | case RouteParam = ":[a-zA-Z0-9-_]+"
23 | case UrlParam = "([^/]+)"
24 | }
25 |
26 | enum RegexResult: Error, CustomDebugStringConvertible {
27 | case success(regex: String)
28 | case duplicateRouteParamError(route: String, urlParam: String)
29 |
30 | var debugDescription: String {
31 | switch self {
32 | case .success(let regex):
33 | return "successfully parsed to \(regex)"
34 | case .duplicateRouteParamError(let route, let urlParam):
35 | return "duplicate url param \(urlParam) was found in \(route)"
36 | }
37 | }
38 | }
39 |
40 | let routeParameter = try! NSRegularExpression(pattern: .RouteParam, options: .caseInsensitive)
41 | let urlParameter = try! NSRegularExpression(pattern: .UrlParam, options: .caseInsensitive)
42 |
43 | // parameterized route, ie: /video/:id
44 | open let route: String
45 |
46 | // route in its regular expression pattern, ie: /video/([^/]+)
47 | var routePattern: String?
48 |
49 | // url params found in route
50 | var urlParamKeys = [String]()
51 |
52 | init(aRoute: String) throws {
53 | route = aRoute
54 | switch regex() {
55 | case .success(let regex):
56 | routePattern = regex
57 | case .duplicateRouteParamError(let route, let urlParam):
58 | throw RegexResult.duplicateRouteParamError(route: route, urlParam: urlParam)
59 | }
60 | }
61 |
62 | /**
63 | Forms a regex pattern of the route
64 |
65 | - returns: string representation of the regex
66 | */
67 | func regex() -> RegexResult {
68 | let _route = "^\(route)/?$"
69 | var _routeRegex = NSString(string: _route)
70 | let matches = routeParameter.matches(in: _route, options: [],
71 | range: NSMakeRange(0, _route.characters.count))
72 |
73 | // range offset when replacing :params
74 | var offset = 0
75 |
76 | for match in matches as [NSTextCheckingResult] {
77 |
78 | var matchWithOffset = match.range
79 | if offset != 0 {
80 | matchWithOffset = NSMakeRange(matchWithOffset.location + offset, matchWithOffset.length)
81 | }
82 |
83 | // route param (ie. :id)
84 | let urlParam = _routeRegex.substring(with: matchWithOffset)
85 |
86 | // route param with ':' (ie. id)
87 | let name = (urlParam as NSString).substring(from: 1)
88 |
89 | // url params should be unique
90 | if urlParamKeys.contains(name) {
91 | return .duplicateRouteParamError(route: route, urlParam: name)
92 | } else {
93 | urlParamKeys.append(name)
94 | }
95 |
96 | // replace :params with regex
97 | _routeRegex = _routeRegex.replacingOccurrences(of: urlParam,
98 | with: Pattern.UrlParam.rawValue, options: NSString.CompareOptions.literal, range: matchWithOffset) as NSString
99 |
100 | // update offset
101 | offset += Pattern.UrlParam.rawValue.characters.count - urlParam.characters.count
102 | }
103 |
104 | return .success(regex: _routeRegex as String)
105 | }
106 | }
107 |
108 | // MARK: Hashable
109 |
110 | extension Route: Hashable {
111 | public var hashValue: Int {
112 | return self.route.hashValue
113 | }
114 |
115 | }
116 |
117 | // MARK: Equatable
118 |
119 | extension Route: Equatable {}
120 |
121 | public func ==(lhs: Route, rhs: Route) -> Bool {
122 | return lhs.route == rhs.route
123 | }
124 |
125 | // MARK: NSRegularExpression
126 |
127 | extension NSRegularExpression {
128 |
129 | convenience init(pattern: Route.Pattern, options: NSRegularExpression.Options) throws {
130 | try self.init(pattern: pattern.rawValue, options: options)
131 | }
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/Source/Router.h:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | #import
18 |
19 | //! Project version number for Router.
20 | FOUNDATION_EXPORT double RouterVersionNumber;
21 |
22 | //! Project version string for Router.
23 | FOUNDATION_EXPORT const unsigned char RouterVersionString[];
24 |
25 | // In this header, you should import all the public headers of your framework using statements like #import
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Source/Router.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 |
19 | public typealias RouteHandler = (_ req: Request) -> Void
20 |
21 | open class Router {
22 |
23 | fileprivate var orderedRoutes = [Route]()
24 | fileprivate var routes = [Route: RouteHandler]()
25 |
26 | public init() {}
27 | /**
28 | Binds a route to a router
29 |
30 | - parameter aRoute: A string reprsentation of the route. It can include url params, for example id in /video/:id
31 | - parameter callback: Triggered when a route is matched
32 | */
33 | open func bind(_ aRoute: String, callback: @escaping RouteHandler) {
34 | do {
35 | let route = try Route(aRoute: aRoute)
36 | orderedRoutes.append(route)
37 | routes[route] = callback
38 | } catch let error as Route.RegexResult {
39 | print(error.debugDescription)
40 | } catch {
41 | fatalError("[\(aRoute)] unknown bind error")
42 | }
43 | }
44 |
45 | /**
46 | Matches an incoming URL to a route present in the router. Returns nil if none are matched.
47 |
48 | - parameter url: An URL of an incoming request to the router
49 | - returns: The matched route or nil
50 | */
51 | open func match(_ url: URL) -> Route? {
52 |
53 | guard let routeComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
54 | return nil
55 | }
56 |
57 | // form the host/path url
58 | let host = routeComponents.host.flatMap({"/\($0)"}) ?? ""
59 | let path = routeComponents.path
60 | let routeToMatch = "\(host)\(path)"
61 | let queryParams = routeComponents.queryItems
62 | var urlParams = [URLQueryItem]()
63 |
64 | // match the route!
65 | for route in orderedRoutes {
66 | guard let pattern = route.routePattern else {
67 | continue
68 | }
69 |
70 | var regex: NSRegularExpression
71 |
72 | do {
73 | regex = try NSRegularExpression(pattern: pattern,
74 | options: .caseInsensitive)
75 | } catch let error as NSError {
76 | fatalError(error.localizedDescription)
77 | }
78 |
79 | let matches = regex.matches(in: routeToMatch, options: [],
80 | range: NSMakeRange(0, routeToMatch.characters.count))
81 |
82 | // check if routeToMatch has matched
83 | if matches.count > 0 {
84 | let match = matches[0]
85 |
86 | // gather url params
87 | for i in 1 ..< match.numberOfRanges {
88 | let name = route.urlParamKeys[i-1]
89 | let value = (routeToMatch as NSString).substring(with: match.rangeAt(i))
90 | urlParams.append(URLQueryItem(name: name, value: value))
91 | }
92 |
93 | // fire callback
94 | if let callback = routes[route] {
95 | callback(Request(aRoute: route, urlParams: urlParams, queryParams: queryParams))
96 | }
97 |
98 | // return route that was matched
99 | return route
100 | }
101 | }
102 |
103 | // nothing matched
104 | return nil
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Tests/RouterMatchingPerfTests.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import XCTest
19 | @testable import Router
20 |
21 | class RouterMatchingPerfTests: XCTestCase {
22 |
23 | var myRouter: Router!
24 | let numOfRoutes = 1000
25 |
26 | override func setUp() {
27 | super.setUp()
28 | // Put setup code here. This method is called before the invocation of each test method in the class.
29 | myRouter = Router()
30 |
31 | for i in 0 ..< numOfRoutes {
32 | myRouter.bind("/\(i)/a/:a/b/:b/c/:c/d/:d/e/:e/f/:f") { (req) -> Void in
33 | XCTAssert(req.param("a")! == "apple", "Invalid req param")
34 | XCTAssert(req.param("b")! == "bar" , "Invalid req param")
35 | XCTAssert(req.param("c")! == "cat" , "Invalid req param")
36 | XCTAssert(req.param("d")! == "dog" , "Invalid req param")
37 | XCTAssert(req.param("e")! == "elephant" , "Invalid req param")
38 | XCTAssert(req.param("f")! == "asdf1234" , "Invalid req param")
39 | }
40 | }
41 |
42 | }
43 |
44 | override func tearDown() {
45 | // Put teardown code here. This method is called after the invocation of each test method in the class.
46 | super.tearDown()
47 | myRouter = nil
48 | }
49 |
50 | func testPerformanceExample() {
51 | // This is an example of a performance test case.
52 | self.measure() {
53 | // Put the code you want to measure the time of here.
54 | _ = self.myRouter.match(URL(string: "/\(self.numOfRoutes - 1)/a/apple/b/bar/c/cat/d/dog/e/elephant/f/asdf1234")!)
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/Tests/RouterSpecs.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import Quick
19 | import Nimble
20 | @testable import Router
21 |
22 | class RouterSpecs: QuickSpec {
23 |
24 | override func spec() {
25 |
26 | describe("Route") {
27 |
28 | describe(".regex") {
29 |
30 | it("converts /video/:id to regex /video/([^/]+)/?") {
31 | let route = try! Route(aRoute: "/video/:id")
32 | expect(route.routePattern).to(equal("^/video/([^/]+)/?$"))
33 | }
34 |
35 | it("converts /shows/:showId/video/:id to regex /shows/([^/]+)/video/([^/]+)/?") {
36 | let route = try! Route(aRoute: "/shows/:showId/video/:id")
37 | expect(route.routePattern).to(equal("^/shows/([^/]+)/video/([^/]+)/?$"))
38 | }
39 |
40 | it("converts routes with many params to a regex pattern") {
41 | let route = try! Route(aRoute: "/a/:a/b/:b/c/:c/d/:d/e/:e/f/:f")
42 | expect(route.routePattern).to(equal("^/a/([^/]+)/b/([^/]+)/c/([^/]+)/d/([^/]+)/e/([^/]+)/f/([^/]+)/?$"))
43 | }
44 |
45 | it("converts routes with many variable length params to a regex pattern") {
46 | let route = try! Route(aRoute: "/a/:abc/b/:bcdef/third/:cx/d/:d123/efgh/:e987654/:lastOne")
47 | expect(route.routePattern).to(equal("^/a/([^/]+)/b/([^/]+)/third/([^/]+)/d/([^/]+)/efgh/([^/]+)/([^/]+)/?$"))
48 | }
49 |
50 | it("converts non parameterized routes to a regex pattern") {
51 | let route = try! Route(aRoute: "/shows")
52 | expect(route.routePattern).to(equal("^/shows/?$"))
53 | }
54 |
55 | it("raises exception with identical url params in route") {
56 | do {
57 | let _ = try Route(aRoute: "/shows/:id/:id")
58 | } catch Route.RegexResult.duplicateRouteParamError(let route, let param) {
59 | expect(route).to(equal("/shows/:id/:id"))
60 | expect(param).to(equal("id"))
61 | } catch {
62 | fail()
63 | }
64 | }
65 |
66 | }
67 |
68 | }
69 |
70 | describe("Router") {
71 |
72 | describe(".match") {
73 | let route = "/video/:id"
74 | var myRouter: Router?
75 |
76 | beforeEach() {
77 | myRouter = Router()
78 | }
79 |
80 | it("allows alpha numeric and _, - characters in params") {
81 | let example = URL(string: "/video/123-asdf_foo-bar?q=123-_-")!
82 | myRouter?.bind(route) {
83 | (req) in
84 | expect(req.param("id")!).to(equal("123-asdf_foo-bar"))
85 | expect(req.query("q")).to(equal("123-_-"))
86 | }
87 |
88 | let matched = myRouter!.match(example)!
89 | expect(matched.route).to(equal(route))
90 | }
91 |
92 | it("returns 1234 as :id in /video/1234") {
93 | let example = URL(string: "/video/1234")!
94 | myRouter?.bind(route) {
95 | (req) in
96 | expect(req.param("id")!).to(equal("1234"))
97 | expect(req.query("id")).to(beNil())
98 | }
99 |
100 | let matched = myRouter!.match(example)!
101 | expect(matched.route).to(equal(route))
102 | }
103 |
104 | it("handles routes with many params") {
105 | let example = URL(string: "/a/1/b/22/third/333/d/4444/efgh/55/6?q=asdf&fq=-alias")!
106 | let aRoute = "/a/:abc/b/:bcdef/third/:cx/d/:d123/efgh/:e987654/:lastOne"
107 |
108 | myRouter?.bind(aRoute) {
109 | (req) in
110 | expect(req.param("abc")!).to(equal("1"))
111 | expect(req.param("bcdef")!).to(equal("22"))
112 | expect(req.param("cx")!).to(equal("333"))
113 | expect(req.param("d123")!).to(equal("4444"))
114 | expect(req.param("e987654")!).to(equal("55"))
115 | expect(req.param("lastOne")!).to(equal("6"))
116 | expect(req.query("q")!).to(equal("asdf"))
117 | expect(req.query("fq")!).to(equal("-alias"))
118 | }
119 |
120 | let matched = myRouter!.match(example)!
121 | expect(matched.route).to(equal(aRoute))
122 | }
123 |
124 | it("does not match routes with malformed query strings") {
125 | let example = URL(string: "/video/123/&q=asdf")!
126 |
127 | myRouter?.bind(route) {
128 | (req) in
129 | expect(req.query("q")).to(beNil())
130 | }
131 |
132 | expect(myRouter!.match(example)).to(beNil())
133 | }
134 |
135 | it("accepts query strings with '?&' sequence") {
136 | myRouter?.bind(route) {
137 | (req) in
138 | expect(req.param("id")!).to(equal("1234"))
139 | expect(req.query("q")!).to(equal("asdf"))
140 | }
141 |
142 | var matched = myRouter!.match(URL(string: "/video/1234/?&q=asdf")!)!
143 | expect(matched.route).to(equal(route))
144 |
145 | matched = myRouter!.match(URL(string: "/video/1234?&q=asdf")!)!
146 | expect(matched.route).to(equal(route))
147 | }
148 |
149 | it("matches routes at the start of the string, not suffix") {
150 | myRouter?.bind(route) {
151 | (req) in
152 | expect(0).to(equal(1))
153 | }
154 |
155 | let matched = myRouter!.match(URL(string: "/shows/1234/video/1234")!)
156 | expect(matched).to(beNil())
157 | }
158 |
159 | it("doesn't mix url param id with query param id") {
160 | let example = URL(string: "/video/1234?id=asdf")!
161 | myRouter?.bind(route) {
162 | (req) in
163 | expect(req.param("id")!).to(equal("1234"))
164 | expect(req.query("id")).to(equal("asdf"))
165 | }
166 |
167 | let matched = myRouter!.match(example)!
168 | expect(matched.route).to(equal(route))
169 | }
170 |
171 | it("matches specific routes before general when binded first") {
172 | myRouter?.bind("/video/jersey-shore") { (req) in expect(0).to(equal(0)) }
173 | myRouter?.bind("/video/:id") { (req) in expect(0).to(equal(1)) }
174 |
175 | if let myRoute = myRouter?.match(URL(string: "/video/jersey-shore")!) {
176 | expect(myRoute.route).to(equal("/video/jersey-shore"))
177 | } else {
178 | expect(0).to(equal(1))
179 | }
180 | }
181 |
182 | it("matches general routes before specific when binded first") {
183 | myRouter?.bind("/video/:id") { (req) in expect(0).to(equal(0)) }
184 | myRouter?.bind("/video/jersey-shore") { (req) in expect(0).to(equal(1)) }
185 |
186 | if let myRoute = myRouter?.match(URL(string: "/video/jersey-shore")!) {
187 | expect(myRoute.route).to(equal("/video/:id"))
188 | } else {
189 | expect(0).to(equal(1))
190 | }
191 | }
192 |
193 | it("returns nil when no route is matched") {
194 | myRouter?.bind(route) {
195 | (req) in
196 | expect(0).to(equal(1))
197 | }
198 |
199 | if let _ = myRouter?.match(URL(string: "/shows/1234")!) {
200 | expect(0).to(equal(1))
201 | } else {
202 | expect(0).to(equal(0))
203 | }
204 | }
205 |
206 | }
207 | }
208 |
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/Tests/RouterTests.swift:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | // Copyright 2015 Viacom Inc.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | ////////////////////////////////////////////////////////////////////////////
16 |
17 | import UIKit
18 | import XCTest
19 | @testable import Router
20 |
21 | class RouterTests: XCTestCase {
22 |
23 | var myRouter: Router!
24 | let numOfRoutes = 10000
25 |
26 |
27 | override func setUp() {
28 | super.setUp()
29 | // Put setup code here. This method is called before the invocation of each test method in the class.
30 | myRouter = Router()
31 |
32 | for i in 0 ..< numOfRoutes {
33 | myRouter!.bind("/test/route/\(i)") { (req) -> Void in
34 | print("matched \(req.route.route)")
35 | }
36 | }
37 |
38 | }
39 |
40 | override func tearDown() {
41 | // Put teardown code here. This method is called after the invocation of each test method in the class.
42 | super.tearDown()
43 | myRouter = nil
44 | }
45 |
46 | func testPerformanceExample() {
47 | // This is an example of a performance test case.
48 | self.measure() {
49 | // Put the code you want to measure the time of here.
50 | _ = self.myRouter.match(URL(string: "/test/route/\(self.numOfRoutes - 1)")!)
51 | }
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------