All Ruby on Rails Node JS Android iOS React Native Frontend

Carrierwave-iOS in Open Source: Easier File Networking

We developed CarrierWave-iOS—an easy-to-use iOS library which provides a flexible way to download, upload and edit asset files. Check it out!

Facing a problem

Together with netguru team, we developed carrierwave-iOS—an easy-to-use iOS library which provides a flexible way to download, upload and edit asset files. It’s designed to integrate with carrierwave-iOS-Rails Ruby gem and ease all your file networking aches and pains.

I always get a headache when working with networks. There’s always some edge case to be dealt with and handled properly. It seems as if I have to force an app to behave the way I want it to, in order to keep the user experience at a very high level.

The headache turns into a migraine when it comes to file networking. Especially when files are big.

I was excited a long time ago during WWDC 2013 to see iOS 7 and OS X 10.9 introduce NSURLSession as a successor of NSURLConnection. Even though NSURLSession is great at solving some problems, I still have to take painkillers.

Two years later, it seems my headaches are coming to an end.

What does carrierwave-iOS do?

First of all, carrierwave-iOS focuses on file networking. It is able to download from and upload to server assets from your mobile app. Moreover, as a developer, you don’t have to worry about the server side. iOS pod has been developed together with Ruby gem. This makes the two easily work together and significantly reduces the time to develop your file networking structure.

Secondly, carrierwave-iOS has crop functionality, meaning you can take a photo, edit it and send it to the server—all in one pod! We did our best to expose the API responsible for UI configuration so that you can configure crop view according to your needs.

How does it work?

Under the hood, carrierwave-iOS uses AFHTTPSessionManager (thanks Mattt!) and wraps download and upload tasks with progress reporting in handy blocks to keep code in one place.

Every task has its own unique identifier which can be stored and used to suspend, resume or cancel the task. In case of connection issues, carrierwave-iOS will automatically retry requests after specified time intervals. It’s configurable too.

carrierwave-iOS has a built-in mime-type recognizer. So far, it supports most popular images and videos mime types:

  • image/png, image/jpeg, image/tiff, image/gif

  • video/mp4, video/mov

All that magic is covered by a self-explanatory API. With all this great stuff, we hope that using carrierwave-iOS will be pleasure for everyone.

How can I use carrierwave-iOS?

Carrierwave-iOS-Rails has been extracted to a ruby gem. For the sake of simplicity, carrierwave-iOS can be installed with CocoaPods or Carthage dependency manager.

We made carrierwave-iOS as simple to use as possible. The only requirement is a server URL on the iOS side and a working Rails application with the carrierwave-iOS-Rails gem installed and configured on the backend side.

If you want to see it in practice, here are our repos:

  • carrierwave-iOS - an iOS CocoaPod, ready to work with our gem.

  • carrierwave-iOS- Rails backend gem - the Rails gem provides a simple API to manage files using the carrierwave gem. It’s lightweight and easy to configure. To make it even easier to set it up, we prepared an example application that showcases the gem’s usage (below).

  • carrierwave-iOS-Rails-example - an example application using our gem with a working API to manage files. It’s already deployed to Heroku for you to test out. It also contains some additional features like auto-removing old uploads.

For more detailed information, please use the Readme in given repos.

Join in!

We would like to invite you to make our tool even better. Comments? Ideas? Let us know what you think of it!

And finally, feel free to contribute to the project! Open source rocks!

There are more open source projects we’re working on - help yourself with what we’ve got, or join us.

We'd love to meet you on Twitter, too - @netguru

Have a look into one of our latest solution - devise-iOS for simplified authentication.

We're building our future. Let's do this right - join us
New Call-to-action
READ ALSO FROM Open Source
Read also
Need a successful project?
Estimate project or contact us