Author: Chris Lattner
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 XCTest | |
| // Credits: https://github.com/pointfreeco/swift-composable-architecture | |
| //swiftlint:disable empty_string force_cast force_unwrapping unused_closure_parameter function_body_length | |
| class MyCustomTestCase: XCTestCase { | |
| func assertEqual<T: Equatable>( | |
| expected: T, | |
| actual: T | |
| ) { |
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
| # A Best in Class Checklist | |
| A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10. | |
| > To use this, create a Github Issue in your own repo, and simply copy and paste this text. | |
| ## iOS Core Technology | |
| _Things any iOS app can benefit from_ | |
| - [ ] iCloud Sync | |
| - [ ] Focus Filter Support |
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
| final class Loader: BindableObject { | |
| let didChange = PassthroughSubject<Data?, Never>() | |
| var task: URLSessionDataTask! | |
| var data: Data? = nil { | |
| didSet { | |
| didChange.send(data) | |
| } | |
| } | |
| init(_ url: URL) { |
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
| public struct AnyEquatable: Equatable { | |
| private let value: Any | |
| private let equals: Any -> Bool | |
| public init<E: Equatable>(_ value: E) { | |
| self.value = value | |
| self.equals = { ($0 as? E == value) ?? false } | |
| } | |
| } |
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
| po [[UIWindow keyWindow] _autolayoutTrace] // prints layouts ambiguity | |
| po [UIViewController _printHierarchy] // prints view controllers hierarchy | |
| po [view constraintsAffectingLayoutForAxis:0] // horizontal | |
| po [view constraintsAffectingLayoutForAxis:1] // vertical | |
| [view hasAmbiguousLayout] // BOOL | |
| [view exerciseAmbiguityInLayout] // visualizing ambiguity | |
| UIViewAlertForUnsatisfiableConstraints // symbolic breakpoint | |
| UIConstraintBasedLayoutDebugging // symbolic breakpoint |