Using a Core Data template with SwiftUI and running it in Simulator produces a blank white screen.
This is sorted out by clearing data in simulator from "Device->Erase all content and settings".
Post
Replies
Boosts
Views
Activity
Is there any solution for this?
I faced the same issue...
it works fine in simulator but unable to run on physical devices
Then I realised I didn't add app groups to corresponding intent handler.
After adding app groups it worked.
I encountered the same problem. I applied the accentColor modifier of the view to change colour.
//SwiftuiView.swift
PhotoPicker(isPresented: $addImages)
.accentColor(.indigo)
//PhotoPicker.swift
struct PhotoPicker: UIViewControllerRepresentable {
@Binding var isPresented: Bool
func makeUIViewController(context: Context) -> some UIViewController {
var configuration = PHPickerConfiguration()
configuration.filter = .images // filter only to images
configuration.selectionLimit = 5 // ignore limit
let photoPickerViewController = PHPickerViewController(configuration: configuration)
photoPickerViewController.delegate = context.coordinator
return photoPickerViewController
}
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) { }
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
class Coordinator: PHPickerViewControllerDelegate {
private let parent: PhotoPicker
init(_ parent: PhotoPicker) {
self.parent = parent
}
func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
parent.isPresented = false
}
}
}