We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Fleaurent
5 years agoExplorer | Level 4
SwiftyDropbox SwiftUI iOS
Hey all,
I've tried to add the SwiftyDropbox package into my SwiftUI iOS project and followed the GitHub readme:
I updated the following files as recommended using my app key:
- Info.plist...
Fleaurent
5 years agoExplorer | Level 4
I found the following issue regarding SwiftyDropbox and SwiftUI:
I just removed the ScrollView which made Problems, and it seems to work:
struct ContentView : View {
@State var isShown = false
var body : some View {
VStack {
Text("HI!")
Button(action: {
self.isShown.toggle()
}) {
Text("Dropbox....")
}
DropboxView(isShown: $isShown)
}
}
}
struct DropboxView: UIViewControllerRepresentable {
typealias UIViewControllerType = UIViewController
@Binding var isShown : Bool
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
if isShown {
DropboxClientsManager.authorizeFromController(UIApplication.shared,
controller: uiViewController,
openURL: { (url: URL) -> Void in
UIApplication.shared.open(url, options: [:], completionHandler: nil)
})
}
}
func makeUIViewController(context _: Self.Context) -> UIViewController {
return UIViewController()
}
}
--> the authorisation page of Dropbox opens and I can enter my credentials.
My next Problem: when I check the DropcoxClientsManager afterwards, it still contains nil
if DropboxClientsManager.authorizedClient != nil {
- aspiguel5 years agoNew member | Level 2
Fleaurent,
Thank you for being a pioneer of Dropbox and SwiftUI. I've just started playing around with this kit in swiftUI and I'm wondering if you got past your last issue the client manager being nil? Thanks!
- himike124 years agoHelpful | Level 5
Has anyone been able to solve DropboxClientsManager.authorizedClient always equal to nil with SwiftUI?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!