Comments (6)
Hi, I was able to run this component on SwiftUI and it works fine)
import SwiftUI
import UnsplashPhotoPicker
struct UnsplashImagePicker: UIViewControllerRepresentable {
var urlUnsplashImage = [UnsplashPhoto]()
let configuration = UnsplashPhotoPickerConfiguration(
accessKey: "accessKey",
secretKey: "accessKey",
allowsMultipleSelection: false)
func makeUIViewController(context: UIViewControllerRepresentableContext<UnsplashImagePicker>) -> UnsplashPhotoPicker {
let unsplashPhotoPicker = UnsplashPhotoPicker(configuration: configuration)
unsplashPhotoPicker.photoPickerDelegate = context.coordinator
return unsplashPhotoPicker
}
func makeCoordinator() -> UnsplashImagePicker.Coordinator {
return Coordinator(self)
}
class Coordinator: UnsplashPhotoPickerDelegate {
var parent: UnsplashImagePicker
init(_ parent: UnsplashImagePicker) {
self.parent = parent
}
func unsplashPhotoPicker(_ photoPicker: UnsplashPhotoPicker, didSelectPhotos photos: [UnsplashPhoto]) {
print(photos)
}
func unsplashPhotoPickerDidCancel(_ photoPicker: UnsplashPhotoPicker) {
print("Unsplash photo picker did cancel")
}
}
func updateUIViewController(_ uiViewController: UnsplashPhotoPicker, context: UIViewControllerRepresentableContext<UnsplashImagePicker>) {
}
}
from unsplash-photopicker-ios.
and yet there is a problem with this code, the unsplashPhotoPicker function does not work completely, respectively, it is not possible to select an image and nil always returns
Update:
Returning to this problem, I found a small error, now everything works, all the information about the photo is also returned. I updated the code above, suddenly it will be needed!
from unsplash-photopicker-ios.
@lisindima I have yet to dive into SwiftUI, so I'm not sure I understand the issue.
- Do you mean that you'd like the component to be built with SwiftUI?
- Do you mean the component cannot be used in a SwiftUI project?
- What would be required to add support?
from unsplash-photopicker-ios.
Thanks for the answer, I would like to see instructions on how to run this component in swiftui, I'm not sure if this can be done using UIViewControllerRepresentable
from unsplash-photopicker-ios.
Makes sense, I will see if I can test it this week.
from unsplash-photopicker-ios.
Great! Thank you for taking a shot at it! 👏
from unsplash-photopicker-ios.
Related Issues (20)
- Problem with build on Mac Catalyst HOT 1
- Question about using this framework HOT 1
- Serialization Issues in UnsplashPhoto and UnsplashUser HOT 1
- images do not load
- there is no SQL cache DB located at unsplash//Cache.db HOT 4
- Description
- SPM Support HOT 4
- API misuse HOT 2
- Hi
- Could not load NIB with name 'PhotoView' HOT 1
- Code
- Invalid exclude '.../UnsplashPhotoPicker.h': File not found.
- Server Error HOT 1
- many warning: **'unregisterForPreviewing(withContext:)' was deprecated in iOS 13.0
- Is this repo maintained? HOT 3
- Photo Picker Configuration on Obj-C HOT 1
- add a showSearchBar parameter to UnsplashPhotoPickerConfiguration
- author clickable link HOT 2
- change background color of the picker
- SERVER ERROR DUE TO SCHEMA CHANGE HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unsplash-photopicker-ios.