This file contains 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 SwiftUI | |
protocol UIViewRepresentableHelper: UIViewRepresentable { | |
var configuration: (UIViewType) -> () { get set } | |
} | |
@available(iOS 13.0, *) | |
extension UIViewRepresentableHelper { | |
func makeUIView(context: UIViewRepresentableContext<Self>) -> UIViewType { | |
let uiView = UIViewType() |
This file contains 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: - Wrapper | |
@propertyWrapper | |
struct SomeKindOfBool: Decodable { | |
var wrappedValue: Bool | |
init(from decoder: Decoder) throws { | |
let container = try decoder.singleValueContainer() | |
if let stringifiedValue = try? container.decode(String.self) { | |
switch stringifiedValue.lowercased() { | |
case "false", "no", "0", "n", "f": wrappedValue = false |
This file contains 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 | |
@propertyWrapper | |
public struct UserDefaultStorage<T: Codable> { | |
private let key: String | |
private let defaultValue: T | |
private let userDefaults: UserDefaults | |
public init(key: String, default: T, store: UserDefaults = .standard) { |
This file contains 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 | |
@dynamicMemberLookup | |
class NumberAbbreviationFormatter { | |
// MARK: - Internal properties | |
var formatter = NumberFormatter() | |
// MARK: - Static configurations |