Top Banner
Do not reinvent the wheel Make use of Cocoa libraries and ready components Mateusz Klimczak
25
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: [CocoaHeads Tricity] Do not reinvent the wheel

Do not reinvent the wheelMake use of Cocoa libraries and ready components

Mateusz Klimczak

Page 2: [CocoaHeads Tricity] Do not reinvent the wheel

Agenda! Overview of the most popular Cocoa

libraries and ready components ! When to use ready components? ! CocoaPods – an easy way to organise

your components ! Let’s create our own Pod ! Use Gemfile to control the CocoaPods

version ! Discussion

Page 3: [CocoaHeads Tricity] Do not reinvent the wheel

! Probably the most popular iOS library ! Main features:

! Encapsulates the common patterns of communicating with a web application over HTPP: GET, POST, PUT, DELETE, etc.

! Easy request serialisation ! Since 2.0 version support for caching

downloaded images (both in-memory and disk caching)

! Network reachability manager

Page 4: [CocoaHeads Tricity] Do not reinvent the wheel

ReactiveCocoa! Objective-C framework inspired by

Functional Reactive Programming ! Provides APIs for composing and

transforming streams of values ! Instead of using mutable variables RAC

provides signals that capture present and future values

! Widely discussed on last meeting

Page 5: [CocoaHeads Tricity] Do not reinvent the wheel

RAC – usage example

Page 6: [CocoaHeads Tricity] Do not reinvent the wheel

! Amazing tool for crash reporting with support for both iOS and Android

! Provides detailed statistics about crashes ! Recently integrated into Twitter’s Fabric.IO

– mobile platform for mobile analytics, app distribution and reporting

! Allows integration with Trello&BitBucket ! Live example!

Page 7: [CocoaHeads Tricity] Do not reinvent the wheel

CocoaLumberjack! Logging framework for Mac and iOS ! Faster than NSLog ! Main features:

! Send logs over the network ! Use multiple loggers to log simultaneously to

many places (file, console, database) ! Define different log levels per logger

(e.g. log verbose to console, but briefly to log server)

Page 8: [CocoaHeads Tricity] Do not reinvent the wheel

MagicalRecord! Inspired by RoR Active Record Fetching ! Active Record is an approach to accessing

data in database ! Database table is wrapped into a class ! Object instance is tied to a single row in the

database table ! The wrapper class implements properties for

each column in the table ! Allows clear, simple, one-line fetches from

CoreData

Page 9: [CocoaHeads Tricity] Do not reinvent the wheel

FXKeychain! Lightweight wrapper around the Apple

keychain API ! Exposes the commonly used functionality

while hiding complexity of underlying APIs

Page 10: [CocoaHeads Tricity] Do not reinvent the wheel

RHAddressBook! Library for interfacing with the iOS

AddressBook ! All contact attributes on various objects

(Person, Group) are exposed as properties – no more dealing with CF methods

Page 11: [CocoaHeads Tricity] Do not reinvent the wheel

TPKeyboardAvoiding! Universal solution for moving text fields out

of the keyboard in iOS ! Uses UIScrollView/UITableView subclasses

that handles everything for you

Page 12: [CocoaHeads Tricity] Do not reinvent the wheel

PaymentKit! Library providing utility methods for dealing

with credit card payments: ! Credit card number validation&formatting ! Expiration validation ! Credit card type checking ! Credit card providers icons fetching ! Ready to use UI components for to input

card data

Page 13: [CocoaHeads Tricity] Do not reinvent the wheel

card.io

! Provides ready to use credit card scanning

Page 14: [CocoaHeads Tricity] Do not reinvent the wheel

XMLDictionary! Library for parsing and generating XMLs ! Allows parsing XML received from server to

NSDictionary and vice versa

Page 15: [CocoaHeads Tricity] Do not reinvent the wheel

TSMessages! Provides an easy to use class to show little

notification views on the top of the screen

Page 16: [CocoaHeads Tricity] Do not reinvent the wheel

MSDynamicsDrawerViewController! Container view controller

that manages the presentation of a single view controller overlaid over drawer view controllers

! Supports swipe to open and close the drawer

Page 17: [CocoaHeads Tricity] Do not reinvent the wheel

MBProgressHUD! Customisable, easy to use progress HUD

with an indicator while work is being done in background thread

Page 18: [CocoaHeads Tricity] Do not reinvent the wheel

JSQMessagesViewController! Messages UI library for iOS ! Allows displaying media, map location and more

Page 19: [CocoaHeads Tricity] Do not reinvent the wheel

And many, many more…! Kiwi ! Specta ! Masonry ! PureLayout ! GPUImage ! JSONKit ! Facebook/Twitter/Google ! …

Page 20: [CocoaHeads Tricity] Do not reinvent the wheel

When to use ready components? ! We want to save some time (it’s not

always worth it – to be continued) ! Library/component is still developed and

preferably have more than 1 contributor ! We don’t need a full control of the code ! We don’t need to provide a high-level

security ! If it is a UI component, we don’t have to

create highly customised interface

Page 21: [CocoaHeads Tricity] Do not reinvent the wheel

! Dependency manager for Swift and Objective-C project

! According to the http://rubygems.org currently there are over 1.1 million downloads of CocoaPods (it doesn’t mean that there are that many users)

! http://cocoapods.org sites are generating 180k visits per month

! You can try the demo project of the Pod without integrating it into your project

Page 22: [CocoaHeads Tricity] Do not reinvent the wheel

! It’s easy to get started ! Installation:

! gem install cocoapods ! Create Podfile

! pod init ! Add pods references to your Podfile ! Run command:

! pod install ! Use .xcworkspace instead of .xcodeproj

Page 23: [CocoaHeads Tricity] Do not reinvent the wheel

! Life example – let’s create our own Pod!

! Instructions: http://guides.cocoapods.org/making/making-a-cocoapod.html

Page 24: [CocoaHeads Tricity] Do not reinvent the wheel

Gemfile! Use Gemfile to keep the same version of

CocoaPods for everyone in team ! Gemfile should specify the required version

of CocoaPods ! Install pods using:

! bundle exec pod install

Page 25: [CocoaHeads Tricity] Do not reinvent the wheel

Discussion! ! What libraries do you most often use? ! When do you prefer to write your own

code? ! Your experiences!