-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#127: Use Clean Architecture for NumberOfKeys Scene + Unit Tests
Improve unit tests for KeyType scene
- Loading branch information
1 parent
3ba245b
commit a91d957
Showing
16 changed files
with
461 additions
and
44 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
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
40 changes: 40 additions & 0 deletions
40
GroupLockiOS/GroupLock/Scenes/Home_Stack/NumberOfKeysScene/NumberOfKeysConfigurator.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,40 @@ | ||
// | ||
// NumberOfKeysConfigurator.swift | ||
// GroupLock | ||
// | ||
// Created by Sergej Jaskiewicz on 20.07.16. | ||
// Copyright (c) 2016 Lanit-Tercom School. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
// MARK: - Connect View, Interactor, and Presenter | ||
|
||
extension NumberOfKeysViewController: NumberOfKeysPresenterOutput { | ||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | ||
router.passDataToNextScene(segue) | ||
} | ||
} | ||
|
||
extension NumberOfKeysInteractor: NumberOfKeysViewControllerOutput {} | ||
|
||
extension NumberOfKeysPresenter: NumberOfKeysInteractorOutput {} | ||
|
||
class NumberOfKeysConfigurator { | ||
|
||
// MARK: - Configuration | ||
|
||
static func configure(viewController: NumberOfKeysViewController) { | ||
let router = NumberOfKeysRouter() | ||
router.viewController = viewController | ||
|
||
let presenter = NumberOfKeysPresenter() | ||
presenter.output = viewController | ||
|
||
let interactor = NumberOfKeysInteractor() | ||
interactor.output = presenter | ||
|
||
viewController.output = interactor | ||
viewController.router = router | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
GroupLockiOS/GroupLock/Scenes/Home_Stack/NumberOfKeysScene/NumberOfKeysInteractor.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,29 @@ | ||
// | ||
// NumberOfKeysInteractor.swift | ||
// GroupLock | ||
// | ||
// Created by Sergej Jaskiewicz on 20.07.16. | ||
// Copyright (c) 2016 Lanit-Tercom School. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol NumberOfKeysInteractorInput { | ||
var numberOfKeys: Int { get } | ||
var files: [ManagedFile]! { get } | ||
} | ||
|
||
protocol NumberOfKeysInteractorOutput { | ||
|
||
} | ||
|
||
class NumberOfKeysInteractor: NumberOfKeysInteractorInput { | ||
|
||
var output: NumberOfKeysInteractorOutput! | ||
|
||
// MARK: - Business logic | ||
|
||
var numberOfKeys = Crypto.maximumNumberOfKeys | ||
|
||
var files: [ManagedFile]! | ||
} |
14 changes: 14 additions & 0 deletions
14
GroupLockiOS/GroupLock/Scenes/Home_Stack/NumberOfKeysScene/NumberOfKeysModels.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,14 @@ | ||
// | ||
// NumberOfKeysModels.swift | ||
// GroupLock | ||
// | ||
// Created by Sergej Jaskiewicz on 20.07.16. | ||
// Copyright (c) 2016 Lanit-Tercom School. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
// MARK: Scene | ||
struct NumberOfKeys { | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
GroupLockiOS/GroupLock/Scenes/Home_Stack/NumberOfKeysScene/NumberOfKeysPresenter.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,25 @@ | ||
// | ||
// NumberOfKeysPresenter.swift | ||
// GroupLock | ||
// | ||
// Created by Sergej Jaskiewicz on 20.07.16. | ||
// Copyright (c) 2016 Lanit-Tercom School. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol NumberOfKeysPresenterInput { | ||
|
||
} | ||
|
||
protocol NumberOfKeysPresenterOutput: class { | ||
|
||
} | ||
|
||
class NumberOfKeysPresenter: NumberOfKeysPresenterInput { | ||
|
||
weak var output: NumberOfKeysPresenterOutput! | ||
|
||
// MARK: - Presentation logic | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
GroupLockiOS/GroupLock/Scenes/Home_Stack/NumberOfKeysScene/NumberOfKeysRouter.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,36 @@ | ||
// | ||
// NumberOfKeysRouter.swift | ||
// GroupLock | ||
// | ||
// Created by Sergej Jaskiewicz on 20.07.16. | ||
// Copyright (c) 2016 Lanit-Tercom School. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
protocol NumberOfKeysRouterInput { | ||
|
||
} | ||
|
||
class NumberOfKeysRouter: NumberOfKeysRouterInput { | ||
|
||
weak var viewController: NumberOfKeysViewController! | ||
|
||
// MARK: - Navigation | ||
|
||
// MARK: - Communication | ||
|
||
func passDataToNextScene(segue: UIStoryboardSegue) { | ||
|
||
if segue.identifier == "ProvideKey" { | ||
passDataToProvideKeyScene(segue) | ||
} | ||
} | ||
|
||
func passDataToProvideKeyScene(segue: UIStoryboardSegue) { | ||
|
||
let provideKeysViewController = segue.destinationViewController as! ProvideKeyViewController | ||
provideKeysViewController.output.numberOfKeys = (viewController.pickerView.selectedRowInComponent(0) + 1, | ||
viewController.pickerView.selectedRowInComponent(1) + 1) | ||
} | ||
} |
Oops, something went wrong.