We didn't use swift in our app development for iOS devices.
To use API v2 in iOS platform, we need an objective-C version!!!
Please kindly provide an objective-C version!
Thanks for the request! I'm sending it along.
For reference, I believe it's possible to use a Swift library in an Objective C app, though unfortunately I don't have any instructions for doing so available.
Agreed. Most iOS apps are still being written in Objective-C. We really need an Obj-C version of the API.
Is there still no ObjectiveC sdk on github or I can't find it? Or at least an Objective-C project that is using the swift dropbox library.
For API v2, we only have a Swift SDK and currently don't have plans to build an Objective-C SDK. As Greg mentioned, you should be able to just use the Swift SDK from your Objective-C code.
For API v1, the iOS SDK is written in Objective-C, and the code can be downloaded from https://www.dropbox.com/developers-v1/core/sdks/ios.
This decision is insane.
Is there any technical justification you can give me that will allow me to convince my PM that our team now has to learn another programming language to use your API? Box, S3, GDrive, OneDrive and iCloud all have Objective-C apis available. Do you really feel that you'll be able to compete for IOS developer mindshare with just a Swift-based API?
I strongly urge you to reconsider.
I'm a bit confused. Did you run into trouble just using the Swift SDK from your Objective-C project? Or is there some other reason you can't (or don't want to) do that?
For those who haven't tried it yet, I just tried and believe that we'll need to expose the Swift classes to Objective-C explicitly by inheriting from NSObject and adding the @objc decorator. (I was able to make some progress just by making the Dropbox class "@objc public class Dropbox : NSObject", but I believe there is more work to do to expose the full functionality.)
We'll try to make sure it's easy to use the Swift SDK from Objective-C code before the Swift SDK is taken out of beta. Please let me know if you have other concerns about using the Swift SDK from your Objective-C projects.
> We'll try to make sure it's easy to use the Swift SDK from Objective-C code before the Swift SDK is taken out of beta.
Nice, I hope you'll come up with something because my knowledge of swift is worse than my french and my french is rather poor.
Back-pedaling here a bit, sorry. After further investigation yesterday, it looks to me like making it easy to call SwiftyDropbox from Objective-C is going to be considerably more work than I thought. I don't think Objective-C support will make it into the initial release of the SDK, but it is something we will look at after the initial release.
We'd welcome contributions from the community here if perhaps someone on this thread is more experienced with mixing Swift and Objective-C than we are. The biggest challenge identified so far is the use of enums.
I don't think that full support of Objective-C is reasonable here. Cause Swift provides more good development patterns based on its structs and enums that are not accessible from Objective-C. The best solution here from my point of view is If you want to use Swift SDKs from your Objective-C code than write the wrapper in Swift that will handle the paradigm difference as you like. May be it will push you to write projects in Swift. It's good since 2.0 version
Without obj-c support, we will skip Dropbox support in any of our new app developments and use iCloud for our initial version.
This is also a trade-off for Dropbox.
The more limit set by Dropbox, the less scope of the app users in iOS platform.
As I said, we plan to add support for Objective-C users. I don't have an ETA yet, but once we finish up the Swift SDK and take it out of beta, it's going to be the next thing we work on in the library.
If this comes in phases .. it would be good to get the Files.Metadata classes available in Objective-C. I find it convenient to keep meta associated with a Dropbox path in my App. I need to handle all the various Files.Metadata sub classes.
The Users.Account class would also be useful, but sine any app only has one to a few accounts ... this is less needed (i.e. it can be easily wrapped)
Deriving from NSObject would be the first, then adding @objc to all protocols. + You're still limited only to apps that support dynamic frameworks, so iOS8+. And if you use CocoaPods (which many of us do), you cannot really mix and match dynamic frameworks and static libs. If you are using static libs, you'll have to manually integrate this framework.
I usually read "no ETA" as in "1-2 years". Looks like I'm sticking with iCloud.
@Steve, my team and I make the Workflow app and we disappointed in your decision to write the Dropbox v2 SDK in Swift. We are not able to adopt Swift yet because:
- Including Swift code in an app causes the entire Swift runtime to be included in the app, which substantially increases the size of the app, the amount of time it takes for the user to download it, and the amount of space it takes on the user's phone.
- Additionally, the Swift programming language is still rapidly evolving, and Swift code you write today may not compile tomorrow. This makes Swift a bad choice for large codebases like ours.
- New versions of Swift are tied to new versions of Xcode and iOS. When iOS 10 enters beta, it will come alongside a new version of Swift that will not compile with the production, shipping version of Xcode (which you must use to submit apps to the App Store). Therefore we'd have to fork our codebase between the two versions of Swift.
For the reasons I outlined above, we will not be able to adopt Swift until the language is more stable and the runtime is included in iOS. This means that even if you add Objective-C support to the framework, we will not be able to use it and will have to write our own version of the SDK from scratch.
This has not been a problem with other SDKs, as it is standard practice for vendors to write their SDKs in Objective-C. Most major iOS apps (and indeed, the iOS frameworks and apps themselves) are still written in Objective-C and I believe you are making a sizable mistake by writing the new Dropbox SDK in Swift, let alone not including Objective-C compatibility. A lot of developers will be unable to use this SDK. The correct way of doing this would be to distribute an Objective-C SDK that works with both Objective-C and Swift apps, and perhaps an additional Swift wrapper if you want to provide a more Swift-native interface.
Completely agree with @ari can someone provide some kind of rational as to why this decision was made? It will be quite a while before swift is included with iOS and the extra app size is substantial. if written in Obj-C this library could easily be used in swift
I think it's unlikely that this will change soon ... Swifty is bootstrapped from Alamofire which is also a Swift base framework However Alamofire is derived from an Open Source Objective-C library.
In general I like the style of the new interface ... passing blocks/closures for the completion of a request as opposed to the delegate model of the previous objective-c API. But this can still be done in Objective-C ... In fact I wrapped the previous API in a layer that looks a lot like the new API. I still need the wrapper layer now ... because I need to call it from Objective-C ... but the wrapper is pretty trivial.
Just adding a note to the great arguments @Ari mentioned: for agencies supporting multiple customers at once with projects of different size and probably not updated code bases for months/years but still in heavy use, it is already ****** to argue to update APPs for such simple things as outdated APIs. Putting even more pressure into this situation is definitely not ending in an switch-to-swift decision but rather a drop of DropBox support in the first place.
As an API/SDK provider going swift only is definitely too far stretched.
Thanks for all the detailed feedback! As requested, let me explain some of our thinking. I'm just one person who worked on this, but I'll do my best to explain the thought process.
When we first started work on SDKs for API v2, we looked at a few options for how to support iOS developers:
#3 is somewhat appealing in that it allows for building SDKs very specifically tailored to the features of each language. But it has the downside of doubling the support/maintenance cost.
#1 is possible, but the experience of using an Objective-C library from Swift is not great, and then the SDK can't take advantage of great Swift features like enums.
We ultimately decided to take the approach in #2 and build only a Swift SDK. The runtime size is indeed a concern, but we expect Swift development to become more and more popular over time. We'll eventually deprecate API v1, but we haven't set a timeline for that yet. I suspect that by the time API v1 is fully deprecated, this won't be much of a concern anymore.
It turns out that making a Swift SDK easily accessible from Objective-C code is harder than we anticipated! When we came to this realization, we considered a few options for how to make the SDK work better for all iOS developers:
Because we're not that deep into our investigation of #3 yet, it's possible we'll discover things that make us want to revisit the decision.
For those of you (RTS?) who built your own wrappers on top of the Swift SDK, would you mind sharing what worked well/poorly?
@Steve, thanks for providing the additional information and for your transparency. I'll just quickly reiterate that for us (and for many other iOS developers), including any Swift code in our app is not an option at this point in time.
Your decision to not write the SDK itself in Objective-C on the grounds that "the experience of using an Objective-C library from Swift is not great" doesn't seem logical to me, because the converse (not being able to use Swift code in Objective-C) is a far more severe problem. Also keep in mind that all of Apple's iOS system frameworks are written in Objective-C, and Swift developers are more than capable of using them. Apple has made some great additions to Objective-C recently (nullability, generics) specifically to improve this type of interoperability.
If I were in your shoes, I would invest your time into re-working the new SDK to be written solely in Objective-C, and perhaps distribute a nice Swift wrapper with fancy enums if that is something that developers are interested in. Maintaining 2 separate SDKs does not seem like a good choice. The majority of iOS apps today are written in Objective-C, not Swift. Your goal as an SDK vendor should be to ensure that your SDK is usable by the most number of developers, and potentially excluding more than half of your audience due to a programming language choice is a poor decision.
Steve,
My wrapper is very specific to my APP. So I do not think it would be applicable as a general API. My wrapper handles all of the errors. It's a simple object that references the Client Object and has a bunch of methods to manipulate the DB Files API. They typically return nil for error or the primary subject of the method like the Metadata or Account info.
You mention the strong dependencies of enums for your choice of Swift. This does not really provide anything of value to the consumers of the API. It may have been useful in the implementation, You could have achieved similar results with a consistent design pattern that maps int enum value in the JSON response to an appropriate object class.
The types that pass across the API's public interface are already objects like Metadata, Account, and Error Types..
So you could have provided the SAME Swift User experience to users with an API written entirely in Objective-C
As I said previously: The style of passing completion blocks/closures for each request is a tremendous improvement over the previous delegate based model.
Here's an example of non-numeric enums that I quite like:
if let authResult = Dropbox.handleRedirectURL(url) { switch authResult { case .Success(let token): print("Success! User is logged into Dropbox with token: \(token)") case .Error(let error, let description): print("Error \(error): \(description)") }}
I think that now build a library "only" in swift it's senseless, better make calls on server HTTP (S) (PUT e GET) with NSURLSessionDataTask and NSURLSessionDownloadTask ... the version 1 it deprecated and do not allows background session ...
My app is object-c and for now we have no intention to migrate in swift !
thanks
Another long time iOS developer here with a huge codebase and quite a few clients with running apps that require maintenance, and no plans to be switching to Swift anytime soon.
It's all nice that we have these hipsters jumping on the Swift bandwagon as soon as it came along (it's from Apple so it should be the next great thing right?), but stability issues in Xcode at first and language changes along the road makes you think twice about switching all your Objective C code to Swift, unless you do this as a hobby and not write iOS apps for a living.
There is a huge amount of code out there that is written in Objective C. Using Objective C from Swift is a lot easier than the inverse (which might be impossible in some cases as you have shown yourself), and there are a lot of apps out there (you will know better than me) that already integrate with Dropbox. You can't possibly expect all those developers to switch languages or include the Swift runtime + all the problems when trying to get the thing to compile if they want to maintain their app and integrate SDK V2?
I think there has been a wrong decision at Dropbox: since you guys started a new SDK from scratch anyway it would make sense to just use the latest and "greatest" tech to write it in.
I am currently writing an SDK myself for one of my clients, and doing it in Objective C for the reasons mentioned by my colleagues in the previous posts.
Let's talk Android: would it make sense to build an Android SDK which would only work on Android 6.0 today? For me it is a similar story with iOS.
http://ericasadun.com/2016/01/05/swift-development-realities/
Yet another long time ObjC developer. I agree with everyone here and I desperately need an ObjC wrapper atleast
@Steve, I wanted to point out that its now Jan 28. I have a couple of months to migrate from DBDataStores to some new model with text files using a totally new swift-based SDK without a Sync Api at all.
I am trying ****** to find a way to successfully transition from Datastores to File-based Sync, redoing the logic and everything else. With some respectable users already using my app, I'm pretty scared.
Please tell us if you have any plans at all to release some ObjC SDK or, at-least, a Wrapper. I would really like some notice on your part before I again invest months and months and have it turned out to not last (Datastores).
So, please, let us know what you are upto with this issue. Time is really running out for some of us Datastores lovers.
PS: I'm just sad Datastores are ending, Its not that they're special to make/host, they're special because of Dropbox behind it. Oh well!
Just chiming in, another ObjC developer wanting v2!
I think Dropbox is ignoring those developing and building value for them. Following changes in technology is fine but maintaining existing technologies is as important. It is about securing investments. Deprecating an API generates lot of efforts for the developer community. Leaving those willing to support this change nevertheless with no option is even worse.
I have a large Objective C code base and nearly a dozen of apps on the store. I will try to keep the v1 API as long as possible and drop Dropbox support afterwards. There are other options.
Thanks everyone for all of the feedback! We read everything and sincerely appreciate the time taken to write it.
To be clear, we hear and understand the need for Objective-C support. As Steve mentioned earlier in the thread, we intended for Objective-C support to be available, but made a misjudgment about the technical barriers to making that possible. That unfortunately means it will take us longer than we intended to offer it.
That said, the good news is that API v1 a.k.a. the Core API is not deprecated, so you can continue to use it. We don't intend on deprecating the Core API for some time, and we will offer a long span of time for migration once we do.