-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
91 changed files
with
4,611 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#### joe made this: https://goel.io/joe | ||
|
||
#####=== Swift ===##### | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control | ||
# | ||
# Pods/ | ||
|
1,595 changes: 1,595 additions & 0 deletions
1,595
19-appendix-c-uikit/Albertos.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
19-appendix-c-uikit/Albertos.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ndix-c-uikit/Albertos.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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,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> |
34 changes: 34 additions & 0 deletions
34
...ndix-c-uikit/Albertos.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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,34 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "CwlCatchException", | ||
"repositoryURL": "https://github.com/mattgallagher/CwlCatchException.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "682841464136f8c66e04afe5dbd01ab51a3a56f2", | ||
"version": "2.1.0" | ||
} | ||
}, | ||
{ | ||
"package": "CwlPreconditionTesting", | ||
"repositoryURL": "https://github.com/mattgallagher/CwlPreconditionTesting.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "02b7a39a99c4da27abe03cab2053a9034379639f", | ||
"version": "2.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "Nimble", | ||
"repositoryURL": "http://github.com/Quick/Nimble.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "af1730dde4e6c0d45bf01b99f8a41713ce536790", | ||
"version": "9.2.0" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
109 changes: 109 additions & 0 deletions
109
19-appendix-c-uikit/Albertos.xcodeproj/xcshareddata/xcschemes/Albertos.xcscheme
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,109 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1230" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8AC2562389E00BF115D" | ||
BuildableName = "Albertos.app" | ||
BlueprintName = "Albertos" | ||
ReferencedContainer = "container:Albertos.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
codeCoverageEnabled = "YES" | ||
onlyGenerateCoverageForSpecifiedTargets = "YES"> | ||
<CodeCoverageTargets> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8AC2562389E00BF115D" | ||
BuildableName = "Albertos.app" | ||
BlueprintName = "Albertos" | ||
ReferencedContainer = "container:TheItalianRestaurant.xcodeproj"> | ||
</BuildableReference> | ||
</CodeCoverageTargets> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8BD2562389F00BF115D" | ||
BuildableName = "AlbertosTests.xctest" | ||
BlueprintName = "AlbertosTests" | ||
ReferencedContainer = "container:Albertos.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
<TestableReference | ||
skipped = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8C8256238A000BF115D" | ||
BuildableName = "AlbertosUITests.xctest" | ||
BlueprintName = "AlbertosUITests" | ||
ReferencedContainer = "container:Albertos.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8AC2562389E00BF115D" | ||
BuildableName = "Albertos.app" | ||
BlueprintName = "Albertos" | ||
ReferencedContainer = "container:Albertos.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3FC9D8AC2562389E00BF115D" | ||
BuildableName = "Albertos.app" | ||
BlueprintName = "Albertos" | ||
ReferencedContainer = "container:Albertos.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
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,7 @@ | ||
struct AlertViewModel { | ||
|
||
let title: String | ||
let message: String | ||
let buttonText: String | ||
let buttonAction: (() -> Void)? | ||
} |
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,84 @@ | ||
import Combine | ||
import UIKit | ||
|
||
class AppCoordinator: MenuListViewControllerNavigationDelegate, OrderDetailViewControllerDelegate { | ||
|
||
let navigationController: UINavigationController | ||
private let orderController: OrderController | ||
private let paymentProcessing: PaymentProcessing | ||
|
||
private lazy var menuListViewController: MenuListViewController = { | ||
let viewController = MenuListViewController(menuFetching: MenuFetcher()) | ||
viewController.navigationDelegate = self | ||
return viewController | ||
}() | ||
|
||
private let orderButton: UIButton | ||
|
||
private lazy var orderButtonViewModel = OrderButtonViewModel(orderController: orderController) | ||
|
||
private var cancellables = Set<AnyCancellable>() | ||
|
||
init( | ||
orderController: OrderController, | ||
paymentProcessing: PaymentProcessing, | ||
navigationController: UINavigationController = UINavigationController() | ||
) { | ||
self.navigationController = navigationController | ||
self.orderController = orderController | ||
self.paymentProcessing = paymentProcessing | ||
|
||
orderButton = BigButton() // a `UIButton` subclass that configures the button style | ||
|
||
orderButtonViewModel.$text | ||
.sink { [weak self] text in | ||
guard let button = self?.orderButton else { return } | ||
button.setTitle(text, for: .normal) | ||
} | ||
.store(in: &cancellables) | ||
|
||
orderButton.addAction( | ||
UIAction(handler: { [weak self] _ in self?.presentOrderDetail()}), | ||
for: .primaryActionTriggered | ||
) | ||
} | ||
|
||
func loadFirstScreen() { | ||
navigationController.viewControllers = [menuListViewController] | ||
|
||
navigationController.view.addSubview(orderButton) | ||
|
||
orderButton.pin(.centerX, to: navigationController.view) | ||
orderButton.alignSafeAreaBottomAnchor(to: navigationController.view) | ||
} | ||
|
||
func orderDetailViewControllerCompletedPaymentFlow(_ viewController: OrderDetailViewController) { | ||
navigationController.dismiss(animated: true, completion: .none) | ||
} | ||
|
||
func menuListViewController( | ||
_ viewController: MenuListViewController, | ||
didSelectItem item: MenuItem | ||
) { | ||
navigationController.pushViewController( | ||
MenuItemDetailViewController( | ||
viewModel: .init(item: item, orderController: orderController) | ||
), | ||
animated: true | ||
) | ||
} | ||
|
||
func presentOrderDetail() { | ||
let orderDetailViewController = OrderDetailViewController( | ||
orderController: orderController, | ||
paymentProcessor: paymentProcessing | ||
) | ||
orderDetailViewController.delegate = self | ||
|
||
navigationController.present( | ||
UINavigationController(rootViewController: orderDetailViewController), | ||
animated: true, | ||
completion: .none | ||
) | ||
} | ||
} |
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,15 @@ | ||
import UIKit | ||
|
||
@main | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
return true | ||
} | ||
|
||
// MARK: - UISceneSession Lifecycle | ||
|
||
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | ||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
19-appendix-c-uikit/Albertos/Assets.xcassets/AccentColor.colorset/Contents.json
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,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.