Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Feb 23, 2024
1 parent a667587 commit ba484d9
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

<img width=200px src=https://github.com/FluidGroup/Brightroom/assets/1888355/df14adc2-97fc-465b-8919-7727c9bae8bd />

```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
}
```

Expand Down

0 comments on commit ba484d9

Please sign in to comment.