Skip to content

Commit

Permalink
💥 fix does not work transition [#59]
Browse files Browse the repository at this point in the history
  • Loading branch information
crexista committed May 29, 2017
1 parent 0f32b0f commit c9b9707
Show file tree
Hide file tree
Showing 37 changed files with 342 additions and 1,442 deletions.
326 changes: 39 additions & 287 deletions Example/Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

25 changes: 11 additions & 14 deletions Example/Sample1/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,29 @@ import KabuKit
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
var producer: Producer?

var root: UIViewController?

var sequence: SceneSequence<Void, SampleSequenceRule>?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

root = UIViewController()

// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window!.rootViewController = UINavigationController(rootViewController: root!)
self.window!.rootViewController?.view.backgroundColor = UIColor.brown
self.window!.backgroundColor = UIColor.white
let nav = UINavigationController(rootViewController: root!)
self.window!.rootViewController = nav
self.window!.makeKeyAndVisible()

root?.navigationController?.setNavigationBarHidden(true, animated: true)
// root?.view.autoresizeMask = super.autoresizeMask
// root?.view.autoresizingMask
let scene = Sample1AViewController(nibName: "Sample1AViewController", bundle: Bundle.main)
producer = Producer.run(sequence: SceneSequence(root!, scene, false) { (stage, scene) in
stage.view.autoresizingMask = (self.root?.view.autoresizingMask)!

stage.addChildViewController(scene)
stage.view.addSubview(scene.view)
scene.view.frame = (self.root?.view.frame)!
})

let rule = SampleSequenceRule()
sequence = SceneSequence<Void, SampleSequenceRule>(rule)

sequence?.startWith(nav, scene, false) { (firstScene, stage) in
nav.pushViewController(firstScene, animated: true)
}
return true
}

Expand Down
62 changes: 0 additions & 62 deletions Example/Sample1/Scenes/Sample1B/Sample1BAction.swift

This file was deleted.

62 changes: 0 additions & 62 deletions Example/Sample1/Scenes/Sample1B/Sample1BScene.swift

This file was deleted.

40 changes: 40 additions & 0 deletions Example/Sample1/Sequence/SampleSequenceRule.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// Copyright © 2017年 DWANGO Co., Ltd.
//

import Foundation
import KabuKit

class SampleALink : Link<Bool> {}
class SampleBLink : Link<Void> {}

class SampleSequenceRule : SequenceRule {
typealias StageType = UINavigationController

let scenario = Scenario<UINavigationController>()
.at(Sample1AViewController.self) { (term) in
term.when(SampleALink.self, to: { Sample1AViewController() }) { (from, stage, next) in
stage.pushViewController(next, animated: true)
}

term.when(SampleBLink.self, to: { Sample1BViewController() }) { (from, stage, next) in
stage.pushViewController(next, animated: true)
}

}.at(Sample1BViewController.self) { (term) in

term.when(SampleALink.self, to: { Sample1AViewController() }) { (from, stage, next) in
stage.pushViewController(next, animated: true)
}

term.when(SampleBLink.self, to: { Sample1BViewController() }) { (from, stage, next) in
stage.pushViewController(next, animated: true)
}
}


func onEnd<S>(page: S, stage: UINavigationController) where S : Page {
stage.popViewController(animated: true)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ extension Sample1AViewController: Scene {
typealias ContextType = Bool

func onPressAButton(sender: UIButton) {
jumpTo(Link<String>(""))
jumpTo(SampleALink(true))
}

func onPressBButton(sender: UIButton) {
jumpTo(SampleBLink())
}

func onPressPrevButton(sender: UIButton) {

prev()
}

// MARK: - Override
Expand All @@ -34,7 +35,4 @@ extension Sample1AViewController: Scene {
nextButtonB.addTarget(self, action: #selector(onPressBButton(sender:)), for: .touchUpInside)
prevButton.addTarget(self, action: #selector(onPressPrevButton(sender:)), for: .touchUpInside)
}

override func viewDidDisappear(_ animated: Bool) {
}
}
34 changes: 34 additions & 0 deletions Example/Sample1/Sequence/Scenes/Sample1B/Sample1BScene.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Sample1BScene.swift
// Example
//
// Created by crexista on 2016/11/24.
// Copyright © crexista. All rights reserved.
//

import Foundation
import KabuKit

extension Sample1BViewController : Scene {

typealias ContextType = Void

func onPressAButton(sender: UIButton) {
jumpTo(SampleALink(true))
}

func onPressBButton(sender: UIButton) {
jumpTo(SampleBLink())
}

func onPressPrevButton(sender: UIButton) {
prev()
}

// MARK: - Override
override func viewDidLoad() {
nextButtonA.addTarget(self, action: #selector(onPressAButton(sender:)), for: .touchUpInside)
nextButtonB.addTarget(self, action: #selector(onPressBButton(sender:)), for: .touchUpInside)
prevButton.addTarget(self, action: #selector(onPressPrevButton(sender:)), for: .touchUpInside)
}
}
57 changes: 0 additions & 57 deletions Example/Sample2/AppDelegate.swift

This file was deleted.

Loading

0 comments on commit c9b9707

Please sign in to comment.