Closed josercc closed 4 years ago
@josercc
UserDefualtsGenerator
can be customized for generated swift code with your own stencil template. You can select to use @PropertyWrapper
, extension UserDefaults
or more testable code with protocol. For example.
public protocol BoolLocalStorage {
func set(_ value: Bool, forKey key: UDGBoolKey)
func get(forKey key: UDGBoolKey) -> Bool
}
extension UserDefaultsGenerator: BoolLocalStorage {
public func set(_ value: Bool, forKey key: UDGBoolKey) { ... }
public func get(forKey key: UDGBoolKey) -> Bool { ... }
}
See more detail to README aboutudg generate
option.
https://github.com/bannzai/UserDefaultsGenerator#udg-generate-command-option-description
And This library user not necessary to write boiler plate swift code. If you want to add or remove UserDefaults
functions, you only write yml file and exec udg generate
command. So, it is easy and integrate format of UserDefaultsGenerate
functions format for your project.
This issue close.
做这个库意义何在? 比如声明