-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from srea/feature/demo
Add Demo
- Loading branch information
Showing
93 changed files
with
4,991 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
github "ReactiveX/RxSwift" ~> 5.1 | ||
github "uber/RIBs" ~> 0.9 | ||
github "uber/RIBs" "0.9.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
github "ReactiveX/RxSwift" "5.1.1" | ||
github "uber/RIBs" "v0.9.2" | ||
github "uber/RIBs" "0.9.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Pods/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
platform :ios, '13.0' | ||
|
||
use_frameworks! | ||
inhibit_all_warnings! | ||
|
||
target 'TicTacToe' do | ||
pod 'RIBs', :git => 'https://github.com/uber/RIBs.git', tag: '0.9.2' | ||
pod 'SnapKit' | ||
pod 'RxCocoa', '~> 5.1.1' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
PODS: | ||
- RIBs (0.9.3): | ||
- RxRelay (~> 5.0) | ||
- RxSwift (~> 5.0) | ||
- RxCocoa (5.1.1): | ||
- RxRelay (~> 5) | ||
- RxSwift (~> 5) | ||
- RxRelay (5.1.1): | ||
- RxSwift (~> 5) | ||
- RxSwift (5.1.1) | ||
- SnapKit (5.0.1) | ||
|
||
DEPENDENCIES: | ||
- RIBs (from `https://github.com/uber/RIBs.git`, tag `0.9.2`) | ||
- RxCocoa (~> 5.1.1) | ||
- SnapKit | ||
|
||
SPEC REPOS: | ||
trunk: | ||
- RxCocoa | ||
- RxRelay | ||
- RxSwift | ||
- SnapKit | ||
|
||
EXTERNAL SOURCES: | ||
RIBs: | ||
:git: https://github.com/uber/RIBs.git | ||
:tag: 0.9.2 | ||
|
||
CHECKOUT OPTIONS: | ||
RIBs: | ||
:git: https://github.com/uber/RIBs.git | ||
:tag: 0.9.2 | ||
|
||
SPEC CHECKSUMS: | ||
RIBs: efceda5df20c1a1e05139232a4638a6242caa92a | ||
RxCocoa: 32065309a38d29b5b0db858819b5bf9ef038b601 | ||
RxRelay: d77f7d771495f43c556cbc43eebd1bb54d01e8e9 | ||
RxSwift: 81470a2074fa8780320ea5fe4102807cb7118178 | ||
SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb | ||
|
||
PODFILE CHECKSUM: e098e2fe24385cac086a3d02c55ea1ff45801a95 | ||
|
||
COCOAPODS: 1.9.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# RIBs Tutorial 4: Deep Linking | ||
|
||
This is the finished code for [tutorial 4](https://github.com/uber/RIBs/wiki/iOS-Tutorial-4). |
655 changes: 655 additions & 0 deletions
655
Example/tutorial4-completed/TicTacToe.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
Example/tutorial4-completed/TicTacToe.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...4-completed/TicTacToe.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
10 changes: 10 additions & 0 deletions
10
Example/tutorial4-completed/TicTacToe.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
Example/tutorial4-completed/TicTacToe.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
21 changes: 21 additions & 0 deletions
21
Example/tutorial4-completed/TicTacToe/ActionableItems/LoggedInActionableItem.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Copyright (c) 2017. Uber Technologies | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import RxSwift | ||
|
||
public protocol LoggedInActionableItem: class { | ||
func launchGame(with id: String?) -> Observable<(LoggedInActionableItem, ())> | ||
} |
21 changes: 21 additions & 0 deletions
21
Example/tutorial4-completed/TicTacToe/ActionableItems/RootActionableItem.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// Copyright (c) 2017. Uber Technologies | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import RxSwift | ||
|
||
public protocol RootActionableItem: class { | ||
func waitForLogin() -> Observable<(LoggedInActionableItem, ())> | ||
} |
24 changes: 24 additions & 0 deletions
24
Example/tutorial4-completed/TicTacToe/AppStart/AppComponent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Copyright (c) 2017. Uber Technologies | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import RIBs | ||
|
||
class AppComponent: Component<EmptyDependency>, RootDependency { | ||
|
||
init() { | ||
super.init(dependency: EmptyComponent()) | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
Example/tutorial4-completed/TicTacToe/AppStart/AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// | ||
// Copyright (c) 2017. Uber Technologies | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import RIBs | ||
import RxSwift | ||
import UIKit | ||
|
||
/// Game app delegate. | ||
@UIApplicationMain | ||
public class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
/// The window. | ||
public var window: UIWindow? | ||
|
||
private var ribsTreeViewer: RIBsTreeViewer? = nil | ||
|
||
/// Tells the delegate that the launch process is almost done and the app is almost ready to run. | ||
/// | ||
/// - parameter application: Your singleton app object. | ||
/// - parameter launchOptions: A dictionary indicating the reason the app was launched (if any). The contents of | ||
/// this dictionary may be empty in situations where the user launched the app directly. For information about | ||
/// the possible keys in this dictionary and how to handle them, see Launch Options Keys. | ||
/// - returns: false if the app cannot handle the URL resource or continue a user activity, otherwise return true. | ||
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | ||
let window = UIWindow(frame: UIScreen.main.bounds) | ||
self.window = window | ||
|
||
let result = RootBuilder(dependency: AppComponent()).build() | ||
let launchRouter = result.launchRouter | ||
self.launchRouter = launchRouter | ||
urlHandler = result.urlHandler | ||
launchRouter.launch(from: window) | ||
startRIBsTreeViewer(launchRouter: launchRouter) | ||
return true | ||
} | ||
|
||
public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { | ||
urlHandler?.handle(url) | ||
return true | ||
} | ||
|
||
// MARK: - Private | ||
|
||
private var launchRouter: LaunchRouting? | ||
private var urlHandler: UrlHandler? | ||
} | ||
|
||
protocol UrlHandler: class { | ||
func handle(_ url: URL) | ||
} | ||
|
||
|
||
// MARK: - RIBsTreeViewer | ||
|
||
#if DEBUG | ||
import RIBsTreeViewerClient | ||
|
||
extension AppDelegate { | ||
private func startRIBsTreeViewer(launchRouter: Routing) { | ||
if #available(iOS 13.0, *) { | ||
ribsTreeViewer = RIBsTreeViewerImpl.init(router: launchRouter, | ||
options: [.webSocketURL("ws://0.0.0.0:8080"), | ||
.monitoringIntervalMillis(1000)]) | ||
ribsTreeViewer?.start() | ||
} else { | ||
// RIBsTreeViewer is not supported OS version. | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIcons</key> | ||
<dict/> | ||
<key>CFBundleIcons~ipad</key> | ||
<dict/> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleURLName</key> | ||
<string>com.ubercab.Game</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>ribs-training</string> | ||
</array> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Copyright (c) 2017. Uber Technologies | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import RIBs | ||
|
||
public protocol GameListener: class { | ||
func gameDidEnd(with winner: PlayerType?) | ||
} | ||
|
||
public protocol GameBuildable: Buildable { | ||
func build(withListener listener: GameListener) -> ViewableRouting | ||
} | ||
|
||
public protocol Game { | ||
var id: String { get } | ||
var name: String { get } | ||
var builder: GameBuildable { get } | ||
} |
Oops, something went wrong.