@available(macCatalyst 18.1, *)
@available(iOS 18.1, *)
extension CKImageSelectionManager: ImagePlaygroundViewController.Delegate {
public func imagePlaygroundViewController(_ imagePlaygroundViewController: ImagePlaygroundViewController, didCreateImageAt imageURL: URL) {
}
func presentImagePlayground() {
let imagePlaygroundVC = ImagePlaygroundViewController()
// Set delegate to self to receive the callback
imagePlaygroundVC.delegate = self
imagePlaygroundVC.isModalInPresentation = true // Prevents dismissal with swipe if needed
self.delegate?.presentImageSelectionViewController(imagePlaygroundVC)
}
}
This generates an error in the xcode generated swift header.
Hi @corkedlabs and @fehners,
Thank you both for sharing in the forums about this and for filing feedback.
As of iOS 18.2, Objective-C projects may encounter compilation issues when accessing Image Playground. In the meantime you can consider creating a private
or fileprivate
Swift class that adopts ImagePlaygroundViewController.Delegate
, and then creating an intermediate protocol to bring the functionality into your Objective-C project.
Keep an eye on future releases for the option to implement Image Playground more directly into your Objective-C project.
Best,
-J