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 UIAction { | |
convenience init(_ title: String, icon systemIconName: String = "", handler: @escaping UIActionHandler) { | |
self.init(title: title, image: UIImage(systemName: systemIconName), handler: handler) | |
} | |
} |
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 AnalyticsEvent { | |
static func searchForUser(with query: String) -> AnalyticsEvent { | |
return AnalyticsEvent(name: "Search for user", attributes: [.query: query]) | |
} | |
} |
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: - Data | |
protocol FeedItem { | |
} | |
struct ShareFeedItem: FeedItem { | |
let id: String | |
} | |
// MARK: - Delegates |
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 Combine | |
/// Builds `Publisher` with callable promise that can be cancelled. | |
/// Used in requests and other cancellable tasks. | |
/// | |
/// Usage: | |
/// ``` | |
/// CancellableFuture<String, Error> { promise -> AnyCancellable in | |
/// let request = buildHttpRequest() | |
/// request.listenToResponse { result in |
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
/// Low-level lock that allows waiters to block efficiently on contention. | |
/// | |
/// Based on `os_unfair_lock_s` | |
public class UnfairLock { | |
// MARK: - Instance variables | |
private var unfairLock = os_unfair_lock_s() | |
// MARK: - Public |
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
/// Utility protocol for cloning objects. | |
public protocol Clonable { | |
} | |
public extension Clonable { | |
/// Clones object with modifictation: | |
/// | |
/// Example: | |
/// ``` |
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 is peruly marker protocol, | |
/// it allows us to keep action list open, and add more actions | |
/// without breaking existed components. | |
/// | |
/// Also sometimes it is nice to implement `Codable` or `Equatable` | |
public protocol Action {} |