Swiftpack.co - Package - ios-developer-busan/Configuration

Configuration

Usage

  1. Create Xcode Configuration
  2. Configuration Add to Info.plist
  3. Create InfoKey Type
enum ConfigurationInfoKey: String {
    case shortVersion = "CFBundleShortVersionString"
}
  1. Using by property wrapper
@Configuration(infoKey: ConfigurationInfoKey.shortVersion)
var shortVersion: String!

Value Transformer

extension ConfigurationTransformer where T == Bool {
    static var booleanTransformer: ConfigurationTransformer {
        ConfigurationTransformer { value in
            switch value as? String {
            case "YES":
                return true
            case "NO":
                return false
            default:
                return nil
            }
        }
    }
}

@Configuration(infoKey: ConfigurationInfoKey.production, transformer: .booleanTransformer)
var production: Bool!

Github

link
Stars: 1

Dependencies

Used By

Total: 0