-
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.
feat: add a sample scenario that run on iOS 11 and iOS > 13
- Loading branch information
Showing
16 changed files
with
453 additions
and
78 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
Large diffs are not rendered by default.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
Sample/Sample.xcodeproj/xcshareddata/xcschemes/Sample-Internal-iOS11.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,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1250" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "D76DC204271D136200396CE9" | ||
BuildableName = "Sample-Internal-iOS11.app" | ||
BlueprintName = "Sample-Internal-iOS11" | ||
ReferencedContainer = "container:Sample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</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 = "D76DC204271D136200396CE9" | ||
BuildableName = "Sample-Internal-iOS11.app" | ||
BlueprintName = "Sample-Internal-iOS11" | ||
ReferencedContainer = "container:Sample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "D76DC204271D136200396CE9" | ||
BuildableName = "Sample-Internal-iOS11.app" | ||
BlueprintName = "Sample-Internal-iOS11" | ||
ReferencedContainer = "container:Sample.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,45 @@ | ||
<?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>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(MARKETING_VERSION)</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true/> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</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
9 changes: 0 additions & 9 deletions
9
Sample/Sample/Sources/Common/Extensions/Notification+Name.swift
This file was deleted.
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
32 changes: 32 additions & 0 deletions
32
Sample/Sample/Sources/Internal/Extensions/UIView+Autolayout.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,32 @@ | ||
// | ||
// Copyright © 2021 An Tran. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
extension UIView { | ||
func addAutolayoutSubview(_ subview: UIView) { | ||
subview.translatesAutoresizingMaskIntoConstraints = false | ||
addSubview(subview) | ||
} | ||
|
||
func addFillingSubview(_ subview: UIView, inset: CGFloat = 0) { | ||
addAutolayoutSubview(subview) | ||
NSLayoutConstraint.activate([ | ||
subview.leadingAnchor.constraint(equalTo: leadingAnchor, constant: inset), | ||
subview.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -inset), | ||
subview.topAnchor.constraint(equalTo: topAnchor, constant: inset), | ||
subview.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -inset), | ||
]) | ||
} | ||
|
||
func addCenterSubview(_ subview: UIView) { | ||
addAutolayoutSubview(subview) | ||
|
||
NSLayoutConstraint.activate([ | ||
subview.centerXAnchor.constraint(equalTo: centerXAnchor), | ||
subview.centerYAnchor.constraint(equalTo: centerYAnchor), | ||
]) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
Sample/Sample/Sources/Internal/InternalAppDelegateiOS11.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 @@ | ||
// | ||
// Copyright © 2021 An Tran. All rights reserved. | ||
// | ||
|
||
import Scenarios | ||
import UIKit | ||
|
||
@UIApplicationMain | ||
final class InternalAppDelegate: BaseAppDelegate { | ||
|
||
// MARK: Properties | ||
|
||
private lazy var manager = BaseScenariosManager() | ||
|
||
// MARK: APIs | ||
|
||
override func makeRootViewController() -> UIViewController { | ||
manager.makeAppController().rootViewController | ||
} | ||
|
||
override func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
defer { | ||
manager.prepare(window!) | ||
} | ||
|
||
return super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
} | ||
|
||
@objc func application( | ||
_ application: UIApplication, | ||
performActionFor shortcutItem: UIApplicationShortcutItem, | ||
completionHandler: @escaping (Bool) -> Void | ||
) { | ||
let result = manager.performAction(for: shortcutItem) | ||
completionHandler(result) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Sample/Sample/Sources/Internal/Scenarios/PrototypeScenario.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,30 @@ | ||
// | ||
// Copyright © 2021 An Tran. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Scenarios | ||
import UIKit | ||
|
||
final class PrototypeScenario: Scenario { | ||
static var name: String = "Prototype" | ||
static var kind: ScenarioKind = .prototype | ||
|
||
static var rootViewProvider: RootViewProviding { | ||
NavigationAppController(withResetButton: true) { _ in | ||
ViewController() | ||
} | ||
} | ||
} | ||
|
||
private final class ViewController: UIViewController { | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
view.backgroundColor = .white | ||
|
||
let label = UILabel() | ||
label.text = "Prototype" | ||
|
||
view.addCenterSubview(label) | ||
} | ||
} |
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
Oops, something went wrong.