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 ThumbnailProvider<Input> { | |
| associatedtype Input | |
| @MainActor | |
| func makeThumbnail(for input: Input, ofSize size: CGSize) async -> UIImage? | |
| @MainActor | |
| func makeThumbnailSync(for input: Input, ofSize size: CGSize) -> UIImage? | |
| } |
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 underReviewFlag_1 = ProcessInfo.processInfo.environment["CFNETWORK_DIAGNOSTICS"] != nil | |
| let underReviewFlag_2 = ProcessInfo.processInfo.environment["CFNETWORK_HAR_LOGGING"] != nil |
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
| /// https://www.linkedin.com/posts/jacobmartinbartlett_advanced-ios-testing-speed-up-your-tests-activity-7375121681171849216-2gSg | |
| import UIKit | |
| private func isRunningUnitTests() -> Bool { | |
| NSClassFromString("Testing.Test") != nil || | |
| ProcessInfo.processInfo.environment["XCTestBundlePath"] != nil | |
| } | |
| let appDelegateClass: AnyClass = if isRunningUnitTests() { |
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
| /// This file is based on the original source code from: | |
| /// https://github.com/kuttz/SecureYourView | |
| /// Some modifications have been made to adapt it for our use case. | |
| import Foundation | |
| import UIKit | |
| import Combine | |
| /// This custom view is designed to protect its content against screenshots | |
| /// and screen recordings, ensuring that sensitive information cannot be |
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
| /// https://www.swiftbysundell.com/articles/let-vs-var-for-swift-struct-properties/ | |
| @propertyWrapper struct Readonly<Value> { | |
| let wrappedValue: Value | |
| } | |
| extension Readonly: Encodable where Value: Encodable { | |
| func encode(to encoder: Encoder) throws { | |
| var container = encoder.singleValueContainer() | |
| try container.encode(wrappedValue) |
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 protocol with a single `@MainActor` method. | |
| protocol DataStoring { | |
| @MainActor func save() | |
| } | |
| // A struct that does not conform to the protocol. | |
| struct DataStore1 { } | |
| // When we make it conform and add save() at the same time, our method is implicitly @MainActor. |
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 Output { | |
| let string: StringBuilder.Component | |
| } | |
| @resultBuilder | |
| struct StringBuilder { | |
| /// The type of individual statement expressions in the transformed function, |
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 Flow: Equatable { | |
| func isEqual(to value: Self) -> Bool | |
| } | |
| enum Flows {} | |
| extension Flows { | |
| struct FlowOne: Flow, CustomStringConvertible { | |
| let name: String |
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
| /// https://www.donnywals.com/swift-concurrencys-taskgroup-explained/ | |
| /// | |
| /// When an error is thrown from the closure provided to withThrowingTaskGroup, the task group will fail with that error. | |
| /// Before this error is thrown, the task group will mark any unfinished tasks as cancelled to allow them to stop | |
| /// executing work as soon as possible in order to comply with Swift Concurrency's cooperative cancellation. | |
| /// Once all tasks have completed (either by finishing their work or throwing an error), the task group will throw its error and complete. | |
| /// | |
| /// ... | |
| /// |
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 SymmetricKey { | |
| // MARK: Custom Initializers | |
| /// Creates a `SymmetricKey` from a Base64-encoded `String`. | |
| /// | |
| /// - Parameter base64EncodedString: The Base64-encoded string from which to generate the `SymmetricKey`. | |
| init?(base64EncodedString: String) { | |
| guard let data = Data(base64Encoded: base64EncodedString) else { | |
| return nil |
NewerOlder