From 46d936264c2d32fbce64cd8149b27d060df3a48f Mon Sep 17 00:00:00 2001 From: Benedikt Betz Date: Thu, 19 Oct 2023 13:56:09 +0200 Subject: Updated Package implementation, Tests and README --- README.md | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index c07e0ad..3b5b95c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -# SwiftyCrop +# SwiftyCrop - SwiftUI -// TODO: Screenshots, GIFs +

+ + +

## 🔭 Overview SwiftyCrop allows users to seamlessly crop images within their SwiftUI applications. It provides a user-friendly interface that makes cropping an image as simple as selecting the desired area. @@ -31,8 +34,8 @@ The localization file can be found in `Sources/SwiftyCrop/Resources`. ## 🧳 Requirements - iOS 16.0 or later -- Xcode 14.3 or later -- Swift 5.0 or later +- Xcode 15.0 or later +- Swift 5.9 or later ## 💻 Installation @@ -69,8 +72,6 @@ struct ExampleView: View { var body: some View { VStack { /* - Your view implementation here. - Update `selectedImage` with the image you want to crop, e.g. after picking it from the library or downloading it. @@ -79,8 +80,10 @@ struct ExampleView: View { Below is a sample implementation: */ - Button("Show cropper with system image") { - selectedImage = UIImage(systemName: "photo") + Button("Crop downloaded image") { + Task { + selectedImage = await downloadExampleImage() + } showImageCropper.toggle() } @@ -96,6 +99,17 @@ struct ExampleView: View { } } } + + // Example function for downloading an image + private func downloadExampleImage() async -> UIImage? { + let urlString = "https://picsum.photos/1000/1200" + guard let url = URL(string: urlString), + let (data, _) = try? await URLSession.shared.data(from: url), + let image = UIImage(data: data) + else { return nil } + + return image + } } ``` @@ -127,7 +141,7 @@ All issue reports, feature requests, pull requests and GitHub stars are welcomed ## ✍️ Author -Benedikt Betz +Benedikt Betz & Check24 ## 📃 License -- cgit v1.2.3