Skip to content
Snippets Groups Projects
Commit 079e267d authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add AppVersionText view

parent 6f07a194
No related branches found
No related tags found
2 merge requests!119Example app version,!102Release 1.0.0
This commit is part of merge request !119. Comments created here will be created in the context of that merge request.
import SwiftUI
public struct AppVersionText: View {
public init() {}
public var body: some View {
Text("v\(version) (\(build))")
}
var version: String = Bundle.main.shortVersionString ?? "0.0.0"
var build: String = Bundle.main.versionString ?? "0"
}
private extension Bundle {
var shortVersionString: String? {
infoDictionary?["CFBundleShortVersionString"] as? String
}
var versionString: String? {
infoDictionary?["CFBundleVersion"] as? String
}
}
#if DEBUG
struct AppVersionText_Previews: PreviewProvider {
static var previews: some View {
AppVersionText()
.padding()
.previewLayout(.sizeThatFits)
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment