Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moifort/swiftUI-photo-library-picker
Photo Library Picker for SwiftUI
https://github.com/moifort/swiftUI-photo-library-picker
Last synced: about 2 months ago
JSON representation
Photo Library Picker for SwiftUI
- Host: GitHub
- URL: https://github.com/moifort/swiftUI-photo-library-picker
- Owner: moifort
- Created: 2019-09-24T22:12:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-22T13:12:35.000Z (almost 4 years ago)
- Last Synced: 2024-08-03T18:13:14.981Z (5 months ago)
- Language: Swift
- Homepage:
- Size: 19.4 MB
- Stars: 68
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-swiftui-libraries - PhotoLibraryPicker - Photo Library Picker for SwiftUI (Photo-Picker / Content)
README
![GitHub release (latest by date)](https://img.shields.io/github/v/release/moifort/swiftUI-photo-library-picker)
# Photo Library Picker for SwiftUI![sample](./static/sample.png)
![sample](./static/sample.gif)## Installation with Swift Package Manager
Swift Package Manager is integrated within Xcode 11:
1. File → Swift Packages → Add Package Dependency...
2. Paste the repository URL: https://github.com/moifort/swiftUI-photo-library-picker.git
3. Add `NSPhotoLibraryUsageDescription` to `info.plist`## Usage
```swift
import SwiftUI
import PhotoLibraryPicker // Add importstruct ContentView : View {
@State var showActionSheet: Bool = false
@State var pictures = [Picture]()
var body: some View {
VStack {
Button(action: {self.showActionSheet.toggle()}) {
Image(systemName: "plus")
.padding()
.background(Color.secondary)
.mask(Circle())
}.sheet(isPresented: self.$showActionSheet) {PhotoLibraryPicker(self.$pictures)}
List {
ForEach(pictures) { picture in
picture.toImage() // You can fix the size by default width: 100, height: 100
}
}
}
}
}struct ContentView_Previews: PreviewProvider {
static var previews: some View {
Group {
ContentView().environment(\.colorScheme, .dark)
ContentView()
}
}
}
```## Thanks
* To @dillidon for this [project](https://github.com/dillidon/alerts-and-pickers)