Here you go: May the 9th be with you! Getting the suffix information is walled by private APIs. The only way to get it is to use the string version of process info and probably perform a regex to extract and other string fun stuff.
Sean!
import Foundation
class VersionModel: ObservableObject {
init() {}
@Published var value: String = {
let process = ProcessInfo.processInfo.operatingSystemVersionString
return process
}()
}
import SwiftUI
struct ContentView: View {
@EnvironmentObject var model: VersionModel
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Version \(model.value)!")
}
.padding()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(VersionModel())
}
}
import SwiftUI
@main
struct VersionInfoApp: App {
@StateObject var model = VersionModel()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(model)
}
}
}