This file contains hidden or 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
class TransitionDelegate: NSObject { | |
private let duration = 0.5 | |
func configureViews(for state: State, | |
containerView: UIView, | |
backgroundViewController: UIViewController, | |
viewInBackground: UIImageView, | |
viewInForeground: UIImageView, | |
snapshotView: UIImageView) { | |
switch state { |
This file contains hidden or 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
extension TransitionDelegate: UIViewControllerAnimatedTransitioning { | |
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval { | |
return duration | |
} | |
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) { | |
let fromViewController = transitionContext.viewController(forKey: .from)! | |
let toViewController = transitionContext.viewController(forKey: .to)! | |
let containerView = transitionContext.containerView |
This file contains hidden or 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
// MARK: - UNUserNotificationCenterDelegate | |
extension AppDelegate: UNUserNotificationCenterDelegate { | |
func userNotificationCenter(_ center: UNUserNotificationCenter, | |
didReceive response: UNNotificationResponse, | |
withCompletionHandler completionHandler: @escaping () -> Void) { | |
if response.actionIdentifier == "open.action" { | |
// OPEN DOOR | |
} |
This file contains hidden or 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
var sound: SystemSoundID = 0 | |
if let soundURL = Bundle.main.url(forAuxiliaryExecutable: "doorbellRing.caf") { | |
AudioServicesCreateSystemSoundID(soundURL as CFURL, &sound) | |
AudioServicesPlaySystemSound(sound) | |
} |
This file contains hidden or 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
@propertyWrapper | |
struct Dependency<T> { | |
var wrappedValue: T | |
init() { | |
self.wrappedValue = DependencyContainer.resolve() | |
} | |
} | |
final class DependencyContainer { |
This file contains hidden or 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
protocol Pushing { | |
func push(_ target: UIViewController, from parent: UIViewController) | |
} | |
struct Pusher: Pushing { | |
func push(_ target: UIViewController, from parent: UIViewController) { | |
parent.navigationController?.pushViewController(target, animated: true) | |
} | |
} |
This file contains hidden or 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
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions...) -> Bool { | |
DependencyContainer.register(DashboardCoordinator() as DashboardCoordinating) | |
// ... | |
} | |
} | |
final class SomeScreen: UIViewController { |
This file contains hidden or 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
import Quick | |
import Nimble | |
@testable import myapp | |
final class PusherDouble: Pushing { | |
private(set) var didPresentTarget: UIViewController? | |
private(set) var didPresentFrom: UIViewController? | |
} |
This file contains hidden or 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
import UIKit | |
let appDelegate: String? = NSClassFromString("XCTestCase") == nil ? NSStringFromClass(AppDelegate.self) : nil | |
UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, appDelegate) |