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 func makeRandomData() -> [MyModel] { [ MyModel(color: .random) ] } | |
| private final class MyUICollectionViewFlowLayout: UICollectionViewFlowLayout { | |
| var insertingIndexPaths = [IndexPath]() | |
| override func prepare( | |
| forCollectionViewUpdates updateItems: [UICollectionViewUpdateItem] | |
| ) { |
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 | |
| enum HexUidConverter { | |
| static func hexString(from uid: String) -> String { | |
| Data(uid.utf8).hexEncodedString() | |
| } | |
| static func uid(from hexString: String) -> String? { | |
| guard let data = Data(hexString: hexString) else { | |
| return 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
| import UIKit | |
| class LabelWithActivityIndicator: UILabel { | |
| private var activityIndicator: UIActivityIndicatorView = { | |
| let indicator = UIActivityIndicatorView(style: .gray) | |
| indicator.startAnimating() | |
| indicator.hidesWhenStopped = true | |
| return indicator | |
| }() | |
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
| if [ "${CONFIGURATION}" = "Release" ]; then | |
| buildNumber=$(/usr/libexec/PlistBuddy -c 'print :CFBundleVersion' "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
| /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $(expr $buildNumber + 1)" "${PROJECT_DIR}/${INFOPLIST_FILE}" | |
| fi |
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
| disabled_rules: # rule identifiers to exclude from running | |
| - trailing_whitespace | |
| - function_parameter_count | |
| - line_length | |
| - variable_name | |
| - cyclomatic_complexity | |
| - nesting | |
| - conditional_binding_cascade | |
| - force_cast |
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 | |
| protocol FileService { | |
| var observation: Any? { get set } | |
| var session: URLSession { get set } | |
| var fileManager: FileManager { get set } | |
| func fetchAndSaveLocally(url: URL, _ completion: @escaping (_ result: Result<URL, ServiceError>) -> Void) | |
| } | |
| final class DefaultFileService: NSObject, FileService { |
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 CircleProgressView: UIView { | |
| var value: CGFloat = 0 { | |
| didSet { | |
| DispatchQueue.main.async { [weak self] in | |
| self?.animate() | |
| } | |
| } | |
| } |
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 UserDefaults { | |
| @objc dynamic var yourKey: Bool { | |
| return bool(forKey: "yourKey") | |
| } | |
| } | |
| protocol UserDefaultsObservable: AnyObject { | |
| var observation: Any? { get set } | |
| typealias UserDefaultsCompletionHandler = (_ defaults: UserDefaults) -> Void | |
| func addObservation(completion: UserDefaultsCompletionHandler?) |
NewerOlder