{"repo":"Rillieux/PhotoSelectAndCrop","free":true,"listed":false,"github":"https://github.com/Rillieux/PhotoSelectAndCrop","clone":"git clone https://github.com/Rillieux/PhotoSelectAndCrop.git","description":"This package integrates a UIImagePickerController into a SwiftUI app. Obtain 1) a copy of the original image, 2) a scaled and / or cropped version of it, 3) a CGFloat and 4) CGPoint. The CGFloat and CGPoint represent the scale and position of the original image used to make the processed version.","language":"Swift","stars":105,"topics":["ios","crop-image","imagepicker","swiftui","imagepickercontroller"],"license":"MIT","category":"mobile-apps","readme_excerpt":"Photo Select and Crop ===================== This Swift Package integrates the SwiftUI PhotosPicker (PhotosUI) into a SwiftUI app and allows a user to select, scale and position an image to be cropped and saved as a contact's photo, similar to the stock iOS Contacts app. To accomplish this, the project uses a composeImageAttributes() function to send four variables to the parent view: 1) a copy of the original UIImage , 2) a scaled and / or cropped UIImage version of it, 3) a CGFloat , and 4) a CGPoint . The CGFloat and CGPoint represent the scale and position of the original image used to make the processed version. :point up: By saving the original image and scale and position markers and passing them to the ImageMoveAndScaleSheet view, if the user taps the \"Change photo\" button, the original photo is scaled and positioned to allow subsequent adjustments. Requirements - iOS 17.0+ - Swift 5.9+ / Xcode 15+ (Xcode 16 recommended) Implementation Add an ImagePane view to your parent view like this: ImagePane(image: image, isEditMode: $isEditMode, renderingMode: renderingMode, colors: colors) Using CoreData, one might do the following. Define two entities: Contact and ProfileImage , where Contact has a To One relationship to ProfileImage . The ProfileImage entity should have properties that can be mapped to the variables provided to the ImageDisplay struct after the user has selected an image from their library. Then, an ImageAttributes class should be initialized with the propert","default_branch":null,"files":null,"tree":[],"storefront":"/r/Rillieux","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Rillieux/PhotoSelectAndCrop/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}