New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while integrating in Swift UI #455
Comments
Here is the solution:
|
yeah but I figured out a much shorter solution. And I am not sure if what
you are saying is correct , did you actually test it ?
… |
Yes, I have tested. It works. |
Doesn't work for me. I am still getting the same warning in console. How I can fix it? |
Please try the following one: "to call the struct (YummyView(image: Binding<Image?>#>) `class YPImagePickerUIViewController: UIViewController {
} ` |
Thank you! It worked |
Without use of a coordinator how do you go about passing back data to the swiftUI View/Navigate to other swiftUI views on completion? |
@binding is one of SwiftUI’s less used property wrappers, it lets us declare that one value actually comes from elsewhere, and should be shared in both places. |
Hello, |
@TeeAche You have to remove the |
This is my solution. Doesn't produce a blank VC in the background as in the other suggested answers. struct MediaPicker: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> YPImagePicker {
let config = YPImagePickerConfiguration()
let picker = YPImagePicker(configuration: config)
picker.didFinishPicking { [unowned picker] items, _ in
if let photo = items.singlePhoto {
print(photo.fromCamera) // Image source (camera or library)
print(photo.image) // Final image selected by the user
print(photo.originalImage) // original image selected by the user, unfiltered
print(photo.modifiedImage ?? "not modified !") // Transformed image, can be nil
print(photo.exifMeta ?? "no exif metadata") // Print exif meta data of original image."
}
picker.dismiss(animated: true, completion: nil)
}
return picker
}
func updateUIViewController(_ uiViewController: YPImagePicker, context: Context) {}
typealias UIViewControllerType = YPImagePicker
} |
Good solution, thanks! Do you know how to show my custom 'next' screen after user taps "Next" for MediaPicker (like in Instagram, create new post screen is shown after image selected)? |
Do you mind sharing the rest of your SwiftUI code. I am trying to figure out the following:
Thank you |
SwiftUI
MediaPicker.swift
References: |
Below is an attempt to integrate YPImagePicker into SwiftUI. So when I call
YummyViewController
inside aVStack
in the main body ofContentView
I get the error described belowCONSOLE MESSAGE
The text was updated successfully, but these errors were encountered: