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
| // if you want a property to be atomic, we lost that in Swift. This enables that | |
| final class Atomic<A> { | |
| private let queue = DispatchQueue(label: "Atomic serial queue") | |
| private var _value: A | |
| init(_ value: A) { | |
| self._value = value | |
| } | |
| var value: A { | |
| get { |
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
| dismiss(animated: true, completion: { | |
| referenceToUnderlyingViewController.doTheBusiness() | |
| }) |
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 | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| class InjectedViewController: UIViewController { | |
| override func viewWillAppear(_ animated: Bool) { | |
| super.viewWillAppear(animated) | |
| print("INJECTED VIEW WILL APPEAR") | |
| } |
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
| let alert = UIAlertController(title: "title", message: "message", preferredStyle: .alert) | |
| alert.modalPresentationStyle = .fullScreen | |
| print(alert.modalPresentationStyle.rawValue) // 4 aka ".custom" |
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
| UIModalPresentationStyle | iPhone | iPad | |
|---|---|---|---|
| .fullScreen | YES | YES | |
| .pageSheet | YES | NO | |
| .formSheet | YES | NO | |
| .currentContext | YES | YES | |
| .custom | NO | NO | |
| .overFullScreen | NO | NO | |
| .overCurrentContext | NO | NO | |
| .blurOverFullScreen | only on tvOS - N/A | N/A | |
| .popover | YES | NO |
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
| // Generated using Sourcery 0.15.0 — https://github.com/krzysztofzablocki/Sourcery | |
| // DO NOT EDIT | |
| import Foundation | |
| protocol HasFancy { | |
| func rockAndRoll() | |
| func secondMethod() -> Int | |
| } |
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 MockHasFancy: HasFancy { | |
| func rockAndRoll() { | |
| } | |
| func secondMethod() -> Int { | |
| } | |
| } |
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
| {% macro methodSig method %} | |
| func {{ method.name }} | |
| {% if method.returnTypeName|!contains:"Void" %} -> {{method.returnTypeName}}{% endif %} | |
| {% endmacro %} | |
| {% for type in types.protocols %} | |
| // sourcery:file:Mock{{ type.name }}.swift | |
| import Foundation | |
| class Mock{{ type.name }}: {{ type.name }} { |
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 UserStoreController { | |
| func getAllUsers() -> [User] | |
| func getUser(_ id: String) -> User | |
| func openProfile(_ user: User) | |
| } |
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
| struct SwiftStructForiOSThatContainsUserAgeData { | |
| let age: Int | |
| } |