This file contains hidden or 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
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
| var window: UIWindow? | |
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
| let storyboard = UIStoryboard(name: "Main", bundle: nil) | |
| if isLogin { | |
| let viewControllerB = storyboard.instantiateViewController(identifier: "ViewControllerB") | |
| window?.rootViewController = UINavigationController(rootViewController: viewControllerB) |
This file contains hidden or 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
| class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
| var window: UIWindow? | |
| private let isLogin = false | |
| func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
| let storyboard = UIStoryboard(name: "Main", bundle: nil) | |
| if isLogin { |
This file contains hidden or 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
| func makeColor(row: Int, count: Int) -> UIColor { | |
| let thresholds = [0, 60, 300, 600, 1200, 3000, 6000, 9000, 12000] | |
| if thresholds.indices.contains(row) { | |
| return count > thresholds[row] ? .gray : .clear | |
| } else { | |
| return .clear | |
| } | |
| } |
This file contains hidden or 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
| func makeColor(row: Int, count: Int) -> UIColor { | |
| switch row { | |
| case 0: | |
| return count > 0 ? .gray : .clear | |
| case 1: | |
| return count > 60 ? .gray : .clear | |
| case 2: | |
| return count > 300 ? .gray : .clear | |
| case 3: | |
| return count > 600 ? .gray : .clear |
This file contains hidden or 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
| let color1 = .clear // 型が分からないのでNG | |
| let color2: UIColor = .clear // 型が分かるのでOK |
This file contains hidden or 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
| func makeColor(row: Int, count: Int) -> UIColor { | |
| switch row { | |
| case 0: | |
| return count > 0 ? UIColor.gray : UIColor.clear | |
| case 1: | |
| return count > 60 ? UIColor.gray : UIColor.clear | |
| case 2: | |
| return count > 300 ? UIColor.gray : UIColor.clear | |
| case 3: | |
| return count > 600 ? UIColor.gray : UIColor.clear |
This file contains hidden or 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
| enum Value { | |
| case string(String) | |
| case int(Int) | |
| } | |
| let string: (String) -> Value = Value.string | |
| let int: (Int) -> Value = Value.int |
This file contains hidden or 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
| Observable | |
| .merge( | |
| stringStream.map(Value.string), | |
| intStream.map(Value.int) | |
| ) |
This file contains hidden or 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
| Observable | |
| .merge( | |
| stringStream.map { Value.string($0) }, | |
| intStream.map { Value.int($0) } | |
| ) | |
| .debounce(.seconds(1), scheduler: MainScheduler.instance) | |
| .subscribe(onNext: { | |
| switch $0 { | |
| case let .string(string): | |
| print(string) |
This file contains hidden or 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
| Observable | |
| .merge( | |
| stringStream.map { Value.string($0) }, | |
| intStream.map { Value.int($0) } | |
| ) | |
| .debounce(.seconds(1), scheduler: MainScheduler.instance) |