diff --git a/README.md b/README.md index 7e1c829c..bbfbe340 100644 --- a/README.md +++ b/README.md @@ -56,29 +56,44 @@ dependencies: [ View the [full documentation](https://www.notion.so/muukii/Brightroom-d4c59b37610a49de8a14131d24cd6162) on Notion. -## Usage +## Built-In UI -**PhotosCropViewController** +**BrightroomUIPhotosCrop.PhotosCropRotation** + + ```swift -// Create an image provider -let imageProvider = ImageProvider(image: uiImage) // URL, Data are also supported. +import SwiftUI +import BtightroomUIPhotosCrop -// Create a Photo Crop View Controller -let controller = PhotosCropViewController(imageProvider: imageProvider) +struct DemoCropView: View { -// Set up handlers when editing finishes -controller.handers -``` + @StateObject var editingStack: EditingStack + @State var resultImage: ResultImage? -## SwiftUI Support (BETA) -*The SwiftUI API is still in-progress and may not be production ready. We're looking for help! 🤲* + init( + editingStack: @escaping () -> EditingStack + ) { + self._editingStack = .init(wrappedValue: editingStack()) + } -```swift -let editingStack: EditingStack + var body: some View { + ZStack { + + VStack { + PhotosCropRotating(editingStack: { editingStack }) + + Button("Done") { + let image = try! editingStack.makeRenderer().render().cgImage + self.resultImage = .init(cgImage: image) + } + } + } + .onAppear { + editingStack.start() + } + } -SwiftUIPhotosCropView(editingStack: editingStack) { - let image = try! editingStack.makeRenderer().render().swiftUIImage } ```