31
CoconutKit Samuel Défago, le studio Cocoaheads — December 2012

CoconutKit

  • Upload
    defagos

  • View
    1.161

  • Download
    0

Embed Size (px)

DESCRIPTION

My talk about CoconutKit 2.0, held at Cocoheads Switzerland in December 2012

Citation preview

Page 1: CoconutKit

CoconutKit

Samuel Défago, le studio

Cocoaheads — December 2012

Page 2: CoconutKit

Who am I?

• iOS developer at le studio (www.hortis.ch)

• Mail: defagos (at) gmail (dot) com

• Twitter: @defagos

• Blog: http://subjective-objective-c.blogspot.com/

• Open-source: https://github.com/defagos

Page 3: CoconutKit

What is CoconutKit?

• Open source project

• A library, not a framework

• Collection of useful and robust components

• Supports ARC and non-ARC projects

• Compatible with iOS 4, 5 and 6

Page 4: CoconutKit

Brief history

• July 2010 — Birth

• August 2011 — First public release 1.0

• October 2011 — Softshake event

• November 2012 — Version 2.0

Page 5: CoconutKit

My goals

• Eliminate cumbersome tasks

• Provide robust components

• Fill system framework gaps

• Keep components easy to use ...

• ... and documented

• Have fun!

Page 6: CoconutKit

Why you should use it?

• Spend more time on your application

• Spend less time on debugging

• Create more robust applications

• Create beautiful applications more easily

• Write better code

Page 7: CoconutKit

Links

• Official github page (https://github.com/defagos/CoconutKit)

• Wiki (https://github.com/defagos/CoconutKit/wiki)

• Binaries (https://github.com/defagos/CoconutKit/downloads)

Page 8: CoconutKit

Adding to a project

• Easy to integrate (~ 2 minutes)

• Easy to update

• Two methods

• Binaries (.staticframework)

• Cocoapods (https://github.com/CocoaPods/CocoaPods)

Page 9: CoconutKit

Components (1)

• View controller containers & API

• Animations

• Dynamic localization

• Core Data extensions

• Controls (label, cursor, text field, etc.)

Page 10: CoconutKit

Components (2)

• Easy view and cell instantiation from nibs

• Lightweight logger

• And more!

Page 11: CoconutKit

Containers

• High-quality containers

• Composition (placeholder VC)

• Navigation (stack controller)

• Custom CA transitions

• Storyboard support

• Compatible with UIKit containers

Page 12: CoconutKit

Placeholder • Embed one or several VCs into another

Example 1 Example 2

-setInsetViewController:atIndex:

Page 13: CoconutKit

Stack • Push / pop view controllers

-pushViewController:withTransitionClass:animated:-popViewController:animated:

-insertViewController:atIndex:withTransitionClass:animated:-removeViewControllerAtIndex:animated:

Page 14: CoconutKit

Stack

Page 15: CoconutKit

Autorotation

• Use iOS 6 methods for all HLSViewController subclasses

• autorotationMode container property

• Available for CoconutKit containers...

• ... and for UIKit ones (no more subclassing)

Page 16: CoconutKit

Why CoconutKit containers?

• Easily change interface and transitions

• Cleanly separate your code

• Manage complex VC hierarchies easily

• Circumvent UIKit limitations (e.g. modal, 3D flip animations)

• API to create your own containers

Page 17: CoconutKit

Animations

• Create in a declarative way

• Combine UIView and CA animations

• Pause and resume, cancel

• Set start time and delay, loop, repeat count

• Play with duration / instantaneously

• Correct behavior when app sent to the background

Page 18: CoconutKit

[self.listAnimation playAnimated:YES];[self.listAnimation reverseAnimation] playAnimated:YES];

Page 19: CoconutKit

Localization

• Change localization at runtime

• nib localization without outlets

Page 20: CoconutKit

[NSBundle setLocalization:@”en”]

- (void)localize{[super localize];

// View controller localization code}

[NSBundle setLocalization:@”ar”]

Page 21: CoconutKit

Strings file

LS/Country of residenceULS/Country of residenceLLS/Country of residenceCLS/Country of residence

Pays de résidencePAYS DE RESIDENCEpays de résidencePays De Résidence

Page 22: CoconutKit

Core Data extensions

• Managed object context (MOC) stack

• Validation done right

• Text field bindings

Page 23: CoconutKit

MOC stack

context-free methods

Page 24: CoconutKit

Validation

• Validations written once

• Called separately or globally

• Error-chaining done right

Page 25: CoconutKit

Text field bindings

• Bind text field to underlying model object field

• Optional formatter

Page 26: CoconutKit

Label

• Vertical alignment

• Font size adjustment even for nbrLines >= 2

Page 27: CoconutKit

Cursor

Page 28: CoconutKit

• Search bar

• Alert view done right

• Slideshows (cross-fade, Ken Burns, ribbon)

• Text field moving to avoid being hidden by the keyboard

And more!

Page 29: CoconutKit

And more!

Page 30: CoconutKit

Thanks for your attention!

Page 31: CoconutKit

Questions?