Skip to content

Instantly share code, notes, and snippets.

@wzieba
Last active September 4, 2024 11:00
Show Gist options
  • Save wzieba/8f9070aa023d5708218394e840324342 to your computer and use it in GitHub Desktop.
Save wzieba/8f9070aa023d5708218394e840324342 to your computer and use it in GitHub Desktop.
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