| Sequence 1 | Sequence 2 | Result |
|---|---|---|
| 1 | 1 | |
| 4 | 4 | |
| 2 | 2 | |
| 3 | 3 |
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 LogInState: ObservableObject { | |
| @Published var isLoggedIn: Bool | |
| init(isLoggedIn: Bool) { | |
| self.isLoggedIn = isLoggedIn | |
| } | |
| func loggedOut() { | |
| isLoggedIn = 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
| import ProjectDescription | |
| import ProjectDescriptionHelpers | |
| let project = Project( | |
| name: Feature.Foo.rawValue, | |
| targets: [ | |
| .feature( | |
| implementation: .Foo, | |
| dependencies: [ | |
| .feature(interface: .Biz), |
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
| ColumnsLayout(columnsNumber: 2) { | |
| VStack { | |
| Text("That's one view") | |
| Image(systemName: "tortoise.fill") | |
| } | |
| .padding() | |
| .border(.red) | |
| Text("That's the second view ") | |
| .padding() | |
| .border(.red) |
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 data = [ | |
| (text: "Nice", subtext: "Onborading sequence of screens"), | |
| (text: "OK", subtext: "But how to do it with SwiftUI?"), | |
| (text: "So that", subtext: "it is nice and shiny"), | |
| ] | |
| let typeCommon: PathPresenter.PathType = | |
| .animated( | |
| transition: .asymmetric( | |
| insertion: .move(edge: .trailing), |
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 MyThread: Thread { | |
| override func main() { // Thread's starting point | |
| print("Hi from thread") | |
| } | |
| } | |
| let thread = MyThread() | |
| thread.start() |
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 enum Accelerate.vDSP | |
| struct AnimatableVector: VectorArithmetic { | |
| var values: [Float] | |
| static var zero = AnimatableVector(values: [0.0]) | |
| static func + (lhs: AnimatableVector, rhs: AnimatableVector) -> AnimatableVector { | |
| let count = min(lhs.values.count, rhs.values.count) | |
| return AnimatableVector( |
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
| Node* find(Node* node, const T& key) { | |
| if (node == nullptr) | |
| return nullptr; | |
| if (node->key == key) | |
| return node; | |
| return find(key >= node->key ? node->right : node->left, key); | |
| } |
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
| template<typename T> | |
| struct Node { | |
| T key; | |
| size_t prior; | |
| Node* left = nullptr, *right = nullptr; | |
| Node(T key, size_t prior) : | |
| key(std::move(key)), | |
| prior(prior) { | |
| } |
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 Foo { | |
| let bonkProvider: () -> DBConnection | |
| lazy var bonk: DBConnection = bonkProvider() | |
| init(_ expression: @escaping @autoclosure () -> DBConnection) { | |
| self.bonkProvider = expression | |
| } | |
| func send() { | |
| // Here bonkProvider() is called | |
| // only for the first call of send() | |
| bonk.sendMessage() |