Last active
September 4, 2024 11:00
-
-
Save wzieba/8f9070aa023d5708218394e840324342 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
struct GravatarProfileSheet: View { | |
@Environment(\.presentationMode) var presentationMode | |
@State private var isLoading = true | |
var email: String | |
var body: some View { | |
NavigationView { | |
VStack { | |
ProfileViewControllerWrapper(email: email) | |
} | |
.navigationTitle("Gravatar profile") | |
.navigationBarItems(trailing: Button(action: { | |
presentationMode.wrappedValue.dismiss() | |
}) { | |
Text("Close") | |
.foregroundColor(.blue) | |
}) | |
} | |
} | |
} | |
struct ProfileViewControllerWrapper: UIViewControllerRepresentable { | |
let email: String | |
func makeUIViewController(context: Context) -> ProfileViewController { | |
let viewController = ProfileViewController( | |
configuration: ProfileViewConfiguration.large(), | |
profileIdentifier: ProfileIdentifier.email(email) | |
) | |
return viewController | |
} | |
func updateUIViewController(_ uiViewController: ProfileViewController, context: Context) { | |
// No need to update the view controller | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment