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 Foundation | |
final class Debouncer { | |
private let block: @Sendable () async -> Void | |
private let duration: ContinuousClock.Duration | |
private var task: Task<Void, Never>? | |
init(duration: ContinuousClock.Duration, block: @Sendable @escaping () async -> Void) { | |
self.duration = duration | |
self.block = block |
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 CircleLoadingView: View { | |
@State private var rotationDegree: Double = 0 | |
var body: some View { | |
ZStack { | |
Circle() | |
.stroke(lineWidth: 4) | |
.frame(width: 40, height: 40) | |
.foregroundStyle(.gray.opacity(0.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
// | |
// AppleColors.swift | |
// ToDoStack | |
// | |
// Created by Ilya Biltuev on 23.04.2024. | |
// | |
import UIKit | |
extension UIColor { |
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 Foundation | |
class KeyboardAppearListener { | |
private weak var viewController: UIViewController? | |
private var isKeyboardShown: Bool = false | |
init(viewController: UIViewController) { | |
self.viewController = viewController |
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 | |
class LoadingButton: UIButton { | |
var originalButtonText: String? | |
var activityIndicator: UIActivityIndicatorView! | |
@IBInspectable | |
let activityIndicatorColor: UIColor = .lightGray |
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
// Create CustomView.xib, set File's Owner to CustomView. | |
// Link the top level view in the XIB to the contentView outlet. | |
class CustomView : UIView { | |
@IBOutlet private var contentView:UIView? | |
// other outlets | |
override init(frame: CGRect) { // for using CustomView in code | |
super.init(frame: frame) | |
self.commonInit() |
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 Foundation | |
import Alamofire | |
typealias JSON = [String: Any] | |
typealias StringClosure = (String?, Error?) -> () | |
typealias JsonClosure = (JSON?, Error?) -> () | |
typealias ResponseClosure<T: Decodable> = (T?, Error?) -> () | |
private final class HttpClient { | |
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 | |
private var loadingViewKey: UInt8 = 0 | |
extension UIViewController { | |
// MARK: - Loading Indicator | |
var loadingIndicator: UIActivityIndicatorView { | |
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
import UIKit | |
/// A validation rule for text input. | |
public enum TextValidationRule { | |
/// Any input is valid, including an empty string. | |
case noRestriction | |
/// The input must not be empty. | |
case nonEmpty | |
/// The enitre input must match a regular expression. A matching substring is not enough. | |
case regularExpression(NSRegularExpression) |