-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an instructions view and a generic paged game view
- Loading branch information
Showing
12 changed files
with
206 additions
and
4 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...-iphonesimulator/Improv Guide.build/Objects-normal/x86_64/Improv Guide-OutputFileMap.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file modified
BIN
-1.56 KB
(98%)
...uide/Build/Intermediates/Improv Guide.build/Debug-iphonesimulator/Improv Guide.build/dgph
Binary file not shown.
Binary file modified
BIN
+8 KB
(100%)
...Data/Improv Guide/Index/Debug/iphonesimulator9.1-x86_64/Improv Guide.xcindex/db.xcindexdb
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
.../Improv Guide/Index/Debug/iphonesimulator9.1-x86_64/Improv Guide.xcindex/db.xcindexdb-shm
Binary file not shown.
Binary file modified
BIN
+4.64 MB
(330%)
.../Improv Guide/Index/Debug/iphonesimulator9.1-x86_64/Improv Guide.xcindex/db.xcindexdb-wal
Binary file not shown.
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// GamePageViewController.swift | ||
// Improv Guide | ||
// | ||
// Created by Ignat Remizov on 12/14/15. | ||
// Copyright © 2015 Ignat Remizov. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class GamePageViewController: UIViewController { | ||
|
||
@IBOutlet var instructions: UITextView! | ||
var step:Int = 0 | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
// Do any additional setup after loading the view. | ||
} | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
|
||
/* | ||
// MARK: - Navigation | ||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | ||
// Get the new view controller using segue.destinationViewController. | ||
// Pass the selected object to the new view controller. | ||
} | ||
*/ | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// PagedGameViewController.swift | ||
// Improv Guide | ||
// | ||
// Created by Ignat Remizov on 12/14/15. | ||
// Copyright © 2015 Ignat Remizov. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class PagedGameViewController: UIPageViewController { | ||
|
||
var gameData: NSDictionary? | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
self.dataSource = self | ||
if let game = self.storyboard?.instantiateViewControllerWithIdentifier("gamePageController") as? GamePageViewController { | ||
self.setViewControllers([game], direction: UIPageViewControllerNavigationDirection.Forward, animated: false, completion: nil) | ||
game.instructions.text = "" | ||
game.instructions.text = (gameData?.valueForKeyPathWithIndexes("Parts[0]") as? String ?? "") | ||
game.step = 0 | ||
|
||
} | ||
} | ||
|
||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
|
||
/* | ||
// MARK: - Navigation | ||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | ||
// Get the new view controller using segue.destinationViewController. | ||
// Pass the selected object to the new view controller. | ||
} | ||
*/ | ||
|
||
} | ||
|
||
extension PagedGameViewController:UIPageViewControllerDataSource { | ||
|
||
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? { | ||
let gameVC = viewController as! GamePageViewController | ||
if gameVC.step == 0 { | ||
return nil | ||
} | ||
let game = self.storyboard?.instantiateViewControllerWithIdentifier("gamePageController") as! GamePageViewController | ||
let _ = game.view | ||
game.step = gameVC.step - 1 | ||
game.instructions.text = gameData?.valueForKeyPathWithIndexes("Parts[\(gameVC.step - 1)]") as? String ?? "" | ||
return game | ||
} | ||
|
||
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? { | ||
let gameVC = viewController as! GamePageViewController | ||
if gameVC.step + 1 >= self.gameData?.valueForKeyPath("Parts.@count") as? Int ?? 0 { | ||
return nil | ||
} | ||
let game = self.storyboard?.instantiateViewControllerWithIdentifier("gamePageController") as! GamePageViewController | ||
let _ = game.view | ||
game.step = gameVC.step + 1 | ||
game.instructions.text = gameData?.valueForKeyPathWithIndexes("Parts[\(game.step)]") as? String ?? "" | ||
|
||
return game | ||
} | ||
|
||
func presentationCountForPageViewController(pageViewController: UIPageViewController) -> Int { | ||
return self.gameData?.valueForKeyPath("Parts.@count") as? Int ?? 0 | ||
} | ||
|
||
func presentationIndexForPageViewController(pageViewController: UIPageViewController) -> Int { | ||
return 0 | ||
} | ||
} |