What's new
PhotoSelectAndCrop 3.0 replaces the deprecated UIImagePickerController (and the unused PHPickerViewController wrapper) with the system SwiftUI PhotosPicker, raises the minimum platform to iOS 17, and modernizes the codebase: @Observable models, UIGraphicsImageRenderer-based cropping, working bundled localization (English and French), force-unwrap crashes removed, an accessibility-friendly picker button, and a CI build on every push.
Requirements
- iOS 17.0+
- Swift 5.9+ / Xcode 15+ (Xcode 16 recommended)
Migrating from 2.x (or 1.x) to 3.0
-
SystemUIImagePickerandSystemPHPickerare removed. The package now presents the systemPhotosPickerinternally; there is nothing to configure. If your app imported these wrapper types directly, adoptPhotosPickerfrom PhotosUI yourself. -
ImageAttributesis now@Observable(and@MainActor) instead ofObservableObject.- Replace
@StateObject var attributes = ImageAttributes(...)with@State private var attributes = ImageAttributes(...). - Replace
@ObservedObject var attributes: ImageAttributeswith a plainvar attributes: ImageAttributes. objectWillChangeand$attributesprojected values no longer exist.- Construct
ImageAttributesin a main-actor context (any SwiftUIVieworAppqualifies). If you build it inside a nonisolated model or CoreData mapping layer, hop to the main actor first.
- Replace
-
ImagePanenow has a single initializer with defaultedrenderingMode,colors, andlinearGradientparameters. All of the previous call shapes still compile unchanged. -
The
Colorshims (Color.systemRed,Color.label, etc.) are deprecated. UseColor(uiColor: .systemRed)and friends instead; the shims will be removed in a future release. -
Localization now actually works. The package's bundled translations (English and French) resolve from the package's own resource bundle (
Bundle.module). If your app previously worked around this by adding the package's string keys (such as "Use photo" or "Move and Scale") to its ownLocalizable.strings, those app-level entries are no longer consulted. Note that iOS only displays languages the host app declares: for the package's French strings to appear, your app must either include French in its own localizations (project ▸ Info ▸ Localizations) or setCFBundleAllowMixedLocalizationstoYESin its Info.plist.