Skip to content

Commit

Permalink
Merge pull request #15 from srea/feature/demo
Browse files Browse the repository at this point in the history
Add Demo
  • Loading branch information
srea authored Jul 8, 2020
2 parents 050b863 + 84e5e6f commit d8ceb21
Show file tree
Hide file tree
Showing 93 changed files with 4,991 additions and 41 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
.swiftpm

# Created by https://www.toptal.com/developers/gitignore/api/swiftpm
# Edit at https://www.toptal.com/developers/gitignore?templates=swiftpm

### SwiftPM ###
Packages
.build/
xcuserdata
DerivedData/
*.xcodeproj


# End of https://www.toptal.com/developers/gitignore/api/swiftpm

# Created by https://www.gitignore.io/api/node,swift,xcode
# Edit at https://www.gitignore.io/?templates=node,swift,xcode
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
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"
2 changes: 1 addition & 1 deletion Cartfile.resolved
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"
1 change: 1 addition & 0 deletions Example/tutorial4-completed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pods/
10 changes: 10 additions & 0 deletions Example/tutorial4-completed/Podfile
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
44 changes: 44 additions & 0 deletions Example/tutorial4-completed/Podfile.lock
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
3 changes: 3 additions & 0 deletions Example/tutorial4-completed/README.md
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 Example/tutorial4-completed/TicTacToe.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>
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, ())>
}
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 Example/tutorial4-completed/TicTacToe/AppStart/AppComponent.swift
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 Example/tutorial4-completed/TicTacToe/AppStart/AppDelegate.swift
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
56 changes: 56 additions & 0 deletions Example/tutorial4-completed/TicTacToe/Info.plist
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>
31 changes: 31 additions & 0 deletions Example/tutorial4-completed/TicTacToe/LoggedIn/Game.swift
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 }
}
Loading

0 comments on commit d8ceb21

Please sign in to comment.