Skip to content

Instantly share code, notes, and snippets.

@OskarGroth
Created April 9, 2021 17:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OskarGroth/75674187041c09b36ffbf297c16706d4 to your computer and use it in GitHub Desktop.
Save OskarGroth/75674187041c09b36ffbf297c16706d4 to your computer and use it in GitHub Desktop.
import SwiftUI
@main
struct SwiftApp: App {
@State var someState = false
var body: some Scene {
WindowGroup {
Rectangle()
.foregroundColor(someState ? .blue : .secondary)
.frame(width: 200, height: 200)
.padding(50)
.onTapGesture {
someState = !someState
}
.navigationTitle("SwiftUI Title")
.onAppear {
DispatchQueue.main.async {
NSApp.windows.first?.title = "Overridden Title"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment