Last active
June 9, 2021 00:03
-
-
Save katzenbaer/9929a61f652ebf63d115f931da7cb48f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AlternateAppIcon13SampleApp.swift | |
// AlternateAppIcon13Sample | |
// | |
// Created by Terrence Katzenbaer on 6/8/21. | |
// | |
import SwiftUI | |
@main | |
struct AlternateAppIcon13SampleApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} | |
struct ContentView: View { | |
let iconName: String = "RelationshipIcon" | |
var body: some View { | |
Button(action: { | |
if UIApplication.shared.alternateIconName == iconName { | |
UIApplication.shared.setAlternateIconName(nil) { (error) in | |
// FIXME: Handle error | |
} | |
} else { | |
UIApplication.shared.setAlternateIconName(iconName) { (error) in | |
// FIXME: Handle error | |
} | |
} | |
}, label: { | |
Text("Swap icon!") | |
}) | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment