SlideShare a Scribd company logo
Building iOS App Project & Architecture

Massimo Oliviero
Freelance Software Developer
About
!

Massimo Oliviero
IT Consultant & Software Developer 

#pragma mark founder

!
!
!

email massimo.oliviero@gmail.com

web www.massimooliviero.net

slide www.slideshare.com/MassimoOliviero

twitter @maxoly
Source
Kimera
A sample iOS application

!

https://github.com/maxoly/Kimera
Agenda

• Project

• Architecture

• Resources
Project
Project

• Conventions

• Structure

• Folders
Conventions
Naming conventions
• First establish a naming convention for all the things

for file names, class names, project names, images, etc.


• Use Pascal Case for files, folders and class

start with a capital letter i.e. Controllers, MyClass, BestAppEver, etc.


• Use Camel Case for methods, properties & variables

start with a lowercase letter i.e setFirstName:, userPassword, etc.


• Avoid using of acronyms and abbreviations

What the hell does it mean “usrPswdLbl”? Yuck!
Coding conventions
• Choose your coding conventions & style

there are ton of conventions out there


• K&R Style, or Allman Indent Style

http://en.wikipedia.org/wiki/Indent_style


• Also read Coding Guidelines for Cocoa by Apple

http://developer.apple.com/library/mac/#documentation/Cocoa/
Conceptual/CodingGuidelines/CodingGuidelines.html


• But most important, choose a convention and respect it

the important thing is always be consistent in your project
Coding Guidelines for Cocoa
An extract from “Coding Guidelines for Cocoa” By Apple
Code
insertObject:atIndex:

insert:at:

removeObjectAtIndex:

Commentary
Good.
Not clear; what is being inserted? what
does “at” signify?

Good.

removeObject:

Good, because it removes object
referred to in argument.

remove:

Not clear; what is being removed?
Structure
Structure
• Create a specific workspace

don’t let Xcode do it for you


• Setting up projects with correct name and prefix

use simple word (only alphanumeric) and at least 3 chars for prefix


• Create a Build Automation to scripting common tasks

to compiling source code or to deploy artifacts with one command


• Create a README file with most important info

you can use markdown syntax or other markup language like that
Structure

• Create a AdHoc and AppStore Build Configuration

So you can handle configuration for different destination


• Configure Build Settings to improve quality

i.e. you can enable Static Analyzer or Treat Warnings as Errors


• Manage third-part libraries with CocoaPods

it reduces headaches of storing/managing 3rd party libraries
Workspace
Project Name & Prefix
• Choose a simple Product Name

Only alphanumeric characters, avoid
spaces


• Choose a right Class Prefix

At least 3 chars, use product name's
acronym 


• Choose your Personal Prefix

Use it in your Library Projects


• Use Automatic Reference Counting

If app targets iOS 5.0 or above
Build Automation
• It’s the act of automating a wide variety of tasks

you can use build tools like Ant, Maven, Make , CMake or Rake


• At least you must automate Compiling and Deploying

compiling and deploying are the most common tasks for developer


• You can also automate Testing and Docs generation

they are useful to use in combination with a Continuous Integration


• You can also automate Static Code Analysis tools

for improving quality and reducing defects by inspecting C, C++ and
Objective-C code
Build Configurations

• Use different Configurations to specialize the behavior

i.e. Code Signing Identity, Preprocessor Macros, Linker Flags, etc.


• Use AdHoc Configuration to deploy testing app

i.e. app for TestFlight with its own Code Signing Identity & Linker Flags


• Use AppStore Configuration to deploy on App Store

Duplicate Release Configuration to use the same optimizations
Build Settings

• Enable Run Static Analyzer 

run the Clang static analysis tool on source
files


• Enable Treat Warning as Errors

it causes all warnings to be treated as errors


• Disable Compress PNG Files

instead use ImageOptim
Build Settings

• Enable new -Ofast optimization Level

it maximizes optimization, use it only in Release build configuration
(Disclaimer: do not use if your application has high level floating point
precision requirement)


• Enable Link-Time Optimization

reduce binary and increase performance
CocoaPods

• Manage third-part libraries with CocoaPods

download from http://cocoapods.org/


• CocoaPods manage dependency for you

it download source files, imports headers and configures flags


• It’s like Ruby Gem but for Objective-C!

you can search pods, install & update with one command
Readme
• The Basics

Describe what it is that your project makes easier. Provide code examples
detailing how the use of the library. Document the installation process.


• Don’t get lazy just because this is for developers

Technical writing is still writing, and need not be dry and boring. Just as if
you were writing an essay or blog post, you should strive to grab the
attention of your reader early. This can be easily accomplished with a
well-written introductory paragraph.


• The code matters

Besides speaking English, your readers also understand code.
Developers love to see code samples, and a few lines of syntax
highlighted source are worth a thousand words.
http://robots.thoughtbot.com/post/50852570430/how-to-write-a-great-readme
Folders
Folders

• Put things in the right place

...and everything makes sense, unfortunately, Xcode doesn’t help us


• Map all Xcode group folders to file system directories

Xcode group folder don’t represent physical folder


• Please remove Supporting Files group folder

Who wants “Supporting Files” anymore? yuck!
My folders structure

• Application

specific app related stuff like AppDelegate, main.m, .pch etc


• Controllers

view (.xib) and view controller stuff put together (obviously)


• Library

specific application classes like helpers, base classes, services, etc
My folders structure

• Models

application domain models and entities, Core Data models too


• Resources

assets like images, fonts, sounds, videos, etc.


• Vendors

third part libraries and frameworks (not managed by CocoaPods)
Controllers

• Put .xib, .h and .m together in the same folders

• One (physical) folder for each view controller

• If there are too many, group them into a subfolder

• Group them by tab (TabBar) or by functions
Resources
• One folder for each type of asset

images, fonts, sounds, videos, strings, plist, samples


• One subfolder for each type of image

buttons, backgrounds, logos, shapes, icons, app (splash etc.)


• If your app support multiple themes, create a hierarchy

themes > themes name > images, fonts, etc.


• Name image files based on state (if no assets catalog)

“button_blue_normal.png”, “button_blue_highlighted.png”, etc.
Folders
Architecture
Architecture...
Application

• Design (programming)

• Layers

• Compositions

• Best Practices
Design
Design
• Typically an application is divided into layers

A layer is a black box with a contract that define an input and output


• To increase the cohesion and decoupling of the software

The layers, if well designed, help to decouple and increase the cohesion


• Cohesion indicates strongly related software module

it would be a subroutine, class or library with common responsibilities


• Coupling measure the level of dependency

between two software module, such as classes, functions or library
Design Principles

• Single Responsibility Principle

A module should have a single responsibility, and that responsibility
should be entirely encapsulated by the module


• Open Closed Principle

A module should be open for extension but closed for modifications


• Liskov’s Substitution Principle

Derived types must be completely substitutable for their base types
Design Principles
• Interface Segregation Principle

Clients should not be forced to depend upon interfaces that they don't
use


• Dependency Inversion Principle

High-level modules should not depend on low-level modules. Both should
depend on abstractions. Abstractions should not depend on details.
Details should depend on abstractions


• SOLID: the "first five principles"

Single responsibility, Open-closed, Liskov substitution, Interface
segregation and Dependency inversion
From Principles to Patterns

• Design Pattern is a general reusable solution 

to a commonly occurring problem within a given context


• It’s a description or template for how to solve a problem 

It’s not a finished design that can be transformed into source code


• There are many types of design patterns

Architectural, Algorithm strategy, Computational, Implementation strategy,
Structural, etc.
Most Common Design Patterns

• Model View Controller Design Pattern

It’s a fundamental design pattern in Objective-C.


• Singleton Design Pattern

For your information the AppDelegate is a singleton


• Chain Of Responsibility Design Pattern

Have you ever met the Next Responder or the First Responder?
Layers
Layers

• Layer represents a logical section of the system

Layer enforce reusability and testability


• A typical client/server app have at least 3 layers

Presentation Layer, Business Layer and Data Access Layer
Layers
!
Views
!
!
!
Controllers
!
Presentation Layer

Service

!
! Domain
Layer
!
Business Layer

Persistence

Model Layer

!
Layer
Network
!
!
Data Access Layer

Layer
Presentation Layer
Presentation Layer

• It have 2 components: the UI and the presentation logic

in Cocoa the UI is the View and the presentation logic is the
(View)Controller


• Cocoa adopt Model View Controller Design Pattern

the Presentation Layer is already in iOS SDK out-of-the-box


• Advanced Appearance Customization with Theme

use Appearance Proxy and Theme technique to customize UI.
Theme
// KMRMTheme.h
typedef NS_ENUM(NSInteger, KMRMThemeLabelType)
{
KMRMThemeLabelTypeArgumentTitle,
KMRMThemeLabelTypeArgumentDescription
};

!

@protocol KMRMTheme <NSObject>

!

- (void)configure;
- (void)themeLabel:(UILabel *)label type:(KMRMThemeLabelType)type;

!

@end

!
!
!
!

// Concrete implementations
#import "KMRMTheme.h"

!

@interface KMRMDefaultTheme : NSObject<KMRMTheme>
@end

!

@interface KMRMGreenTheme : NSObject<KMRMTheme>
@end
Presentation Layer
UIView

UIViewController

!
!
!
!
!
!
!
!
!
!

Model

Appearance

Theme
Business Layer
Business Layer
• It holds the specific app Business Logic and Behaviors

It is concerned with the retrieval, processing, transformation, and
management of application data; application of business rules and
policies


• The Domain Model is a conceptual model of business

It describes the various entities, their attributes, roles, and relationships,
plus the constraints that govern the problem domain


• Business Layer gets data through a Service Layer

Service Layer defines an application's boundary with a layer of services
that establishes a set of available operations and coordinates the
application's response in each operation
Domain Model Layer

• Domain Model

An object model of the domain that incorporates both behavior and data


• You can use simple Objective-C objects

A plain old Objective-C object that inheriting from NSObject


• Or you can use Core Data objects

you can extend the class NSMangedObject with your Objective-C class
Service Layer
• Service Layers is a design pattern

The benefits a Service Layer provides is that it defines a common set of
application operations available to different clients and coordinates the
response in each operation.


• Service Layer uses Data Access Layer to access data

Service Layer uses DAL to performs the task of retrieving and storing data
both from server via network and from database


• Service Layer is used by ViewController

No more a ton of line of codes in your ViewController, instead few lines of
simple Service Layer calls
Data Access Layer
Data Access Layer

• It’s a layer which provides simplified access to data

The data may be stored in a persistent storage like SQLite or in a
backend accessible by network


• It may uses a Persistence Layer or Network Layer

Both exposes a simplify contract to access data
Persistence Layer

• The persistence layer deals with persisting

The persistence layer is responsible for manipulating the database, and it
is used by the service layer


• You can use Core Data as Persistence Layer

Or, in alternative, you can use FMDB for direct access to SQLite
Network Layer

• Network Layer is responsible of all networking calls

• You can use AFNetworking as Network Layer

AFNetworking is a delightful networking library for iOS and Mac OS X. It's
built on top of NSURLConnection, NSOperation, and other familiar
Foundation technologies
Composition
Composition

• It’s a way to combine objects into more complex ones

Compositions are a critical building block of many basic data structures,
including the tagged union, the linked list, and the binary tree, as well as
the object used in object-oriented programming


• In a real-world app composition takes an important role

On iOS / OS X App composition is necessary for a good layering and for
a structure UI.
Composition

• Custom Views are an example of composition

A custom view is used to manage small portions of the interface in order
to recycle the content and its management


• In a real-world iOS/OS App there are many custom views

For example, all views that must be inserted in a scroll view, or all those
portions of the view that occur multiple times in different view and only
with different content.
Best Practices
General Best Practice

• Use Automatic Reference Counting

Always use ARC. All new code should be written using ARC, and all
legacy code should be updated to use ARC


• Use AppDelegate as Singleton

Create all common and singleton objects in App Delegate and then
expose them by UIResponder Category
Coding Best Practices
• Create a property for every ivar and use self to access it

Always create a @property for every data member and use “self.name” to
access it throughout your class implementation


• Alway declare “atomic” or “nonatomic” attribute

Always use the “nonatomic” attribute on your properties, unless you are
writing a thread-safe class and actually need access to be atomic


• Use literals and modern Objective-C syntactic sugar

The source code will be less verbose and more clear.
Presentation Best Practices
• Create a base UIViewController 

Create a MYBaseViewController from which all the view controllers inherit.
In this way all the controllers can inherit common behavior. 


• Create a base UIView 

Create a MYBaseView from which all the custom views inherit. In this way
all the views can inherit common style and appearance


• Create a base UITableViewCell

Create a MYBaseTableViewCell from which all the custom table view cells
inherit. In this way all the cells can inherit common style and appearance
Code Design Best Practices

• API Design

Pay attention to the design of your API. Learn your target platform's
conventions before coding. Define the rules that are in accordance with
the convention of language


• Block and Delegation

When should I use blocks instead of delegation for callbacks? Pay
attention to this topic and alway look at Apple docs to see how they done
Resources
Links

• Blocks vs Delegation

http://thejoeconwayblog.wordpress.com/2012/05/29/blocks-ordelegation/


• API

Design


http://mattgemmell.com/2012/05/24/api-design/


• Modern Objective-C

http://www.slideshare.net/giuseppearici/modern-objectivec-pragma-night
Links
• objc.io - A periodical about best practices and advanced
techniques in Objective-C

http://www.objc.io/


• Automatic Reference Counting recap

http://www.slideshare.net/giuseppearici/pragma-nightautomaticreferencecounting


• How to write a great README

http://robots.thoughtbot.com/post/50852570430/how-to-write-a-greatreadme
Videos

• Customizing the Appearance of UIKit Controls

Session 114 - WWDC 2011 Session Videos


• Advanced Appearance Customization on iOS

Session 216 - WWDC 2012 Session Videos


• What’s New in the LLVM Compiler

Session 402 - WWDC 2013 Session Videos
Books

• Cocoa Design Patterns

• Erik M. Buck & Donald A.
Yacktman


• Addison Wesley
Books

• Patterns Of Enterprise Application
Architecture


• Martin Fowler

• Addison-Wesley Professional

• updates: http://martinfowler.com/
books/eaa.html
Thank you
Massimo Oliviero
IT Consultant & Software Developer 

#pragma mark founder

!
!
email massimo.oliviero@gmail.com

web www.massimooliviero.net

slide www.slideshare.com/MassimoOliviero

twitter @maxoly

Any questions?

More Related Content

What's hot

Android application-component
Android application-componentAndroid application-component
Android application-component
Ly Haza
 
Tk2323 lecture 1 introduction to mobile application
Tk2323 lecture 1   introduction to mobile applicationTk2323 lecture 1   introduction to mobile application
Tk2323 lecture 1 introduction to mobile application
MengChun Lam
 
What's an api
What's an apiWhat's an api
What's an api
Jacques Ledoux
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
Prem Sanil
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | Edureka
Edureka!
 
Introduction to API
Introduction to APIIntroduction to API
Introduction to API
rajnishjha29
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
Suyash Srijan
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptx
BharathYusha1
 
Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)
Ahsanul Karim
 
Python SQLite3...
Python                                                                SQLite3...Python                                                                SQLite3...
Python SQLite3...
VikasTuwar1
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
Patrick Savalle
 
Android resource
Android resourceAndroid resource
Android resource
Krazy Koder
 
Php technical presentation
Php technical presentationPhp technical presentation
Php technical presentation
dharmendra kumar dhakar
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best Practices
Jean-Luc David
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
bloodyedge03
 
Visual studio code
Visual studio codeVisual studio code
Visual studio code
MVP Microsoft
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
Lushanthan Sivaneasharajah
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
Edureka!
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
 
Api presentation
Api presentationApi presentation
Api presentation
Tiago Cardoso
 

What's hot (20)

Android application-component
Android application-componentAndroid application-component
Android application-component
 
Tk2323 lecture 1 introduction to mobile application
Tk2323 lecture 1   introduction to mobile applicationTk2323 lecture 1   introduction to mobile application
Tk2323 lecture 1 introduction to mobile application
 
What's an api
What's an apiWhat's an api
What's an api
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | Edureka
 
Introduction to API
Introduction to APIIntroduction to API
Introduction to API
 
Introduction to Android and Android Studio
Introduction to Android and Android StudioIntroduction to Android and Android Studio
Introduction to Android and Android Studio
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptx
 
Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)
 
Python SQLite3...
Python                                                                SQLite3...Python                                                                SQLite3...
Python SQLite3...
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Android resource
Android resourceAndroid resource
Android resource
 
Php technical presentation
Php technical presentationPhp technical presentation
Php technical presentation
 
iOS Coding Best Practices
iOS Coding Best PracticesiOS Coding Best Practices
iOS Coding Best Practices
 
visual basic v6 introduction
visual basic v6 introductionvisual basic v6 introduction
visual basic v6 introduction
 
Visual studio code
Visual studio codeVisual studio code
Visual studio code
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
Android SDK Tutorial | Edureka
Android SDK Tutorial | EdurekaAndroid SDK Tutorial | Edureka
Android SDK Tutorial | Edureka
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Api presentation
Api presentationApi presentation
Api presentation
 

Viewers also liked

Architecting iOS Project
Architecting iOS ProjectArchitecting iOS Project
Architecting iOS Project
Massimo Oliviero
 
iOS Architecture and MVC
iOS Architecture and MVCiOS Architecture and MVC
iOS Architecture and MVC
Marian Ignev
 
architecture of mobile software applications
architecture of mobile software applicationsarchitecture of mobile software applications
architecture of mobile software applications
Hassan Dar
 
Ios vs android
Ios vs androidIos vs android
Ios vs android
sumitvikram
 
iOS design: a case study
iOS design: a case studyiOS design: a case study
iOS design: a case study
Johan Ronsse
 
Layer architecture of ios (1)
Layer architecture of ios (1)Layer architecture of ios (1)
Layer architecture of ios (1)
dwipalp
 
Course overview 1
Course overview   1Course overview   1
Course overview 1
Michael Shrove
 
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,..."Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
Yandex
 
iOS App Architecture
iOS App ArchitectureiOS App Architecture
iOS App Architecture
Manjula Jonnalagadda
 
Gigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die tryingGigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die trying
Alex Rupérez
 
Session 1 - Introduction to iOS 7 and SDK
Session 1 -  Introduction to iOS 7 and SDKSession 1 -  Introduction to iOS 7 and SDK
Session 1 - Introduction to iOS 7 and SDK
Vu Tran Lam
 
Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
Abhishek Zala
 
Android Vs iOS
Android Vs iOSAndroid Vs iOS
Android Vs iOS
Vaibhav Tomar
 
Iphone vs android
Iphone vs androidIphone vs android
Iphone vs android
xomo
 
Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
Manan Narang
 
Android vs iPhone - Differences in UI Patterns and Design
Android vs iPhone - Differences in UI Patterns and DesignAndroid vs iPhone - Differences in UI Patterns and Design
Android vs iPhone - Differences in UI Patterns and Design
Jeremy Johnson
 
Event based programming in Android
Event based programming in AndroidEvent based programming in Android
Event based programming in Android
Five
 
Лекция 2: Абстрактные типы данных. Алгоритмы сортировки
Лекция 2: Абстрактные типы данных. Алгоритмы сортировкиЛекция 2: Абстрактные типы данных. Алгоритмы сортировки
Лекция 2: Абстрактные типы данных. Алгоритмы сортировки
Mikhail Kurnosov
 
Лекция 3: Бинарный поиск. Связные списки
Лекция 3: Бинарный поиск. Связные спискиЛекция 3: Бинарный поиск. Связные списки
Лекция 3: Бинарный поиск. Связные списки
Mikhail Kurnosov
 
Modernize your Objective-C
Modernize your Objective-CModernize your Objective-C
Modernize your Objective-C
Massimo Oliviero
 

Viewers also liked (20)

Architecting iOS Project
Architecting iOS ProjectArchitecting iOS Project
Architecting iOS Project
 
iOS Architecture and MVC
iOS Architecture and MVCiOS Architecture and MVC
iOS Architecture and MVC
 
architecture of mobile software applications
architecture of mobile software applicationsarchitecture of mobile software applications
architecture of mobile software applications
 
Ios vs android
Ios vs androidIos vs android
Ios vs android
 
iOS design: a case study
iOS design: a case studyiOS design: a case study
iOS design: a case study
 
Layer architecture of ios (1)
Layer architecture of ios (1)Layer architecture of ios (1)
Layer architecture of ios (1)
 
Course overview 1
Course overview   1Course overview   1
Course overview 1
 
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,..."Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
"Architecting and testing large iOS apps: lessons from Facebook". Adam Ernst,...
 
iOS App Architecture
iOS App ArchitectureiOS App Architecture
iOS App Architecture
 
Gigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die tryingGigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die trying
 
Session 1 - Introduction to iOS 7 and SDK
Session 1 -  Introduction to iOS 7 and SDKSession 1 -  Introduction to iOS 7 and SDK
Session 1 - Introduction to iOS 7 and SDK
 
Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
 
Android Vs iOS
Android Vs iOSAndroid Vs iOS
Android Vs iOS
 
Iphone vs android
Iphone vs androidIphone vs android
Iphone vs android
 
Android vs iOS
Android vs iOSAndroid vs iOS
Android vs iOS
 
Android vs iPhone - Differences in UI Patterns and Design
Android vs iPhone - Differences in UI Patterns and DesignAndroid vs iPhone - Differences in UI Patterns and Design
Android vs iPhone - Differences in UI Patterns and Design
 
Event based programming in Android
Event based programming in AndroidEvent based programming in Android
Event based programming in Android
 
Лекция 2: Абстрактные типы данных. Алгоритмы сортировки
Лекция 2: Абстрактные типы данных. Алгоритмы сортировкиЛекция 2: Абстрактные типы данных. Алгоритмы сортировки
Лекция 2: Абстрактные типы данных. Алгоритмы сортировки
 
Лекция 3: Бинарный поиск. Связные списки
Лекция 3: Бинарный поиск. Связные спискиЛекция 3: Бинарный поиск. Связные списки
Лекция 3: Бинарный поиск. Связные списки
 
Modernize your Objective-C
Modernize your Objective-CModernize your Objective-C
Modernize your Objective-C
 

Similar to Building iOS App Project & Architecture

Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
Jayanga V. Liyanage
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
Sisir Ghosh
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
Amr Abd El Latief
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
Ed Musters
 
Case study
Case studyCase study
Case study
karan saini
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
Fáber D. Giraldo
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
Thomas Daly
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
Dmytro Mindra
 
Swift programming language
Swift programming languageSwift programming language
Swift programming language
Nijo Job
 
Presentation 1 Web--dev
Presentation 1 Web--devPresentation 1 Web--dev
Presentation 1 Web--dev
altsav
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
prakashk453625
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
Dave Haeffner
 
25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development
Belighted
 
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Sachintha Gunasena
 
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Arnaud Bouchez
 
Let's Write Better Node Modules
Let's Write Better Node ModulesLet's Write Better Node Modules
Let's Write Better Node Modules
Kevin Whinnery
 
Introduction to Aspect Oriented Programming by Donald Belcham
Introduction to Aspect Oriented Programming by Donald BelchamIntroduction to Aspect Oriented Programming by Donald Belcham
Introduction to Aspect Oriented Programming by Donald Belcham
.NET Conf UY
 
Introduction To AOP
Introduction To AOPIntroduction To AOP
Introduction To AOP
Donald Belcham
 

Similar to Building iOS App Project & Architecture (20)

Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
ASP.NET Session 3
ASP.NET Session 3ASP.NET Session 3
ASP.NET Session 3
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365SharePoint 2013 Sandbox Solutions for On Premise or Office 365
SharePoint 2013 Sandbox Solutions for On Premise or Office 365
 
Case study
Case studyCase study
Case study
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
Swift programming language
Swift programming languageSwift programming language
Swift programming language
 
Presentation 1 Web--dev
Presentation 1 Web--devPresentation 1 Web--dev
Presentation 1 Web--dev
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development25 Real Life Tips In Ruby on Rails Development
25 Real Life Tips In Ruby on Rails Development
 
Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1Concurrency Programming in Java - 02 - Essentials of Java Part 1
Concurrency Programming in Java - 02 - Essentials of Java Part 1
 
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
 
Let's Write Better Node Modules
Let's Write Better Node ModulesLet's Write Better Node Modules
Let's Write Better Node Modules
 
Introduction to Aspect Oriented Programming by Donald Belcham
Introduction to Aspect Oriented Programming by Donald BelchamIntroduction to Aspect Oriented Programming by Donald Belcham
Introduction to Aspect Oriented Programming by Donald Belcham
 
Introduction To AOP
Introduction To AOPIntroduction To AOP
Introduction To AOP
 

More from Massimo Oliviero

Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
Massimo Oliviero
 
Presentazione Community Pragma Mark
Presentazione Community Pragma MarkPresentazione Community Pragma Mark
Presentazione Community Pragma Mark
Massimo Oliviero
 
iOS Programming
iOS ProgrammingiOS Programming
iOS Programming
Massimo Oliviero
 
iOS - Getting Started
iOS - Getting StartediOS - Getting Started
iOS - Getting Started
Massimo Oliviero
 
iOS Ecosystem
iOS EcosystemiOS Ecosystem
iOS Ecosystem
Massimo Oliviero
 
iOS Api Client: soluzioni a confronto
iOS Api Client: soluzioni a confrontoiOS Api Client: soluzioni a confronto
iOS Api Client: soluzioni a confronto
Massimo Oliviero
 

More from Massimo Oliviero (6)

Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)Advanced iOS Debbuging (Reloaded)
Advanced iOS Debbuging (Reloaded)
 
Presentazione Community Pragma Mark
Presentazione Community Pragma MarkPresentazione Community Pragma Mark
Presentazione Community Pragma Mark
 
iOS Programming
iOS ProgrammingiOS Programming
iOS Programming
 
iOS - Getting Started
iOS - Getting StartediOS - Getting Started
iOS - Getting Started
 
iOS Ecosystem
iOS EcosystemiOS Ecosystem
iOS Ecosystem
 
iOS Api Client: soluzioni a confronto
iOS Api Client: soluzioni a confrontoiOS Api Client: soluzioni a confronto
iOS Api Client: soluzioni a confronto
 

Recently uploaded

Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
maigasapphire
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
Safe Software
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
Google Developer Group - Harare
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
The Role of IoT in Australian Mobile App Development - PDF Guide
The Role of IoT in Australian Mobile App Development - PDF GuideThe Role of IoT in Australian Mobile App Development - PDF Guide
The Role of IoT in Australian Mobile App Development - PDF Guide
Shiv Technolabs
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...
chetankumar9855
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
CiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.pptCiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.ppt
moinahousna
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
rajancomputerfbd
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
Zilliz
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Zilliz
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
sunilverma7884
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
Priyanka Aash
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
SynapseIndia
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 

Recently uploaded (20)

Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
Girls Call Churchgate 9910780858 Provide Best And Top Girl Service And No1 in...
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
Data Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining DataData Integration Basics: Merging & Joining Data
Data Integration Basics: Merging & Joining Data
 
Google I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged SlidesGoogle I/O Extended Harare Merged Slides
Google I/O Extended Harare Merged Slides
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
The Role of IoT in Australian Mobile App Development - PDF Guide
The Role of IoT in Australian Mobile App Development - PDF GuideThe Role of IoT in Australian Mobile App Development - PDF Guide
The Role of IoT in Australian Mobile App Development - PDF Guide
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
CiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.pptCiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.ppt
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
Choose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presenceChoose our Linux Web Hosting for a seamless and successful online presence
Choose our Linux Web Hosting for a seamless and successful online presence
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
Girls call Kolkata 👀 XXXXXXXXXXX 👀 Rs.9.5 K Cash Payment With Room Delivery
 
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
(CISOPlatform Summit & SACON 2024) Keynote _ Power Digital Identities With AI...
 
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptxUse Cases & Benefits of RPA in Manufacturing in 2024.pptx
Use Cases & Benefits of RPA in Manufacturing in 2024.pptx
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 

Building iOS App Project & Architecture

  • 1. Building iOS App Project & Architecture Massimo Oliviero Freelance Software Developer
  • 2. About ! Massimo Oliviero IT Consultant & Software Developer #pragma mark founder ! ! ! email massimo.oliviero@gmail.com web www.massimooliviero.net slide www.slideshare.com/MassimoOliviero twitter @maxoly
  • 3. Source Kimera A sample iOS application ! https://github.com/maxoly/Kimera
  • 8. Naming conventions • First establish a naming convention for all the things for file names, class names, project names, images, etc. • Use Pascal Case for files, folders and class start with a capital letter i.e. Controllers, MyClass, BestAppEver, etc. • Use Camel Case for methods, properties & variables start with a lowercase letter i.e setFirstName:, userPassword, etc. • Avoid using of acronyms and abbreviations What the hell does it mean “usrPswdLbl”? Yuck!
  • 9. Coding conventions • Choose your coding conventions & style there are ton of conventions out there • K&R Style, or Allman Indent Style http://en.wikipedia.org/wiki/Indent_style • Also read Coding Guidelines for Cocoa by Apple http://developer.apple.com/library/mac/#documentation/Cocoa/ Conceptual/CodingGuidelines/CodingGuidelines.html • But most important, choose a convention and respect it the important thing is always be consistent in your project
  • 10. Coding Guidelines for Cocoa An extract from “Coding Guidelines for Cocoa” By Apple Code insertObject:atIndex: insert:at: removeObjectAtIndex: Commentary Good. Not clear; what is being inserted? what does “at” signify? Good. removeObject: Good, because it removes object referred to in argument. remove: Not clear; what is being removed?
  • 12. Structure • Create a specific workspace don’t let Xcode do it for you • Setting up projects with correct name and prefix use simple word (only alphanumeric) and at least 3 chars for prefix • Create a Build Automation to scripting common tasks to compiling source code or to deploy artifacts with one command • Create a README file with most important info you can use markdown syntax or other markup language like that
  • 13. Structure • Create a AdHoc and AppStore Build Configuration So you can handle configuration for different destination • Configure Build Settings to improve quality i.e. you can enable Static Analyzer or Treat Warnings as Errors • Manage third-part libraries with CocoaPods it reduces headaches of storing/managing 3rd party libraries
  • 15. Project Name & Prefix • Choose a simple Product Name Only alphanumeric characters, avoid spaces • Choose a right Class Prefix At least 3 chars, use product name's acronym • Choose your Personal Prefix Use it in your Library Projects • Use Automatic Reference Counting If app targets iOS 5.0 or above
  • 16. Build Automation • It’s the act of automating a wide variety of tasks you can use build tools like Ant, Maven, Make , CMake or Rake • At least you must automate Compiling and Deploying compiling and deploying are the most common tasks for developer • You can also automate Testing and Docs generation they are useful to use in combination with a Continuous Integration • You can also automate Static Code Analysis tools for improving quality and reducing defects by inspecting C, C++ and Objective-C code
  • 17. Build Configurations • Use different Configurations to specialize the behavior i.e. Code Signing Identity, Preprocessor Macros, Linker Flags, etc. • Use AdHoc Configuration to deploy testing app i.e. app for TestFlight with its own Code Signing Identity & Linker Flags • Use AppStore Configuration to deploy on App Store Duplicate Release Configuration to use the same optimizations
  • 18. Build Settings • Enable Run Static Analyzer run the Clang static analysis tool on source files • Enable Treat Warning as Errors it causes all warnings to be treated as errors • Disable Compress PNG Files instead use ImageOptim
  • 19. Build Settings • Enable new -Ofast optimization Level it maximizes optimization, use it only in Release build configuration (Disclaimer: do not use if your application has high level floating point precision requirement) • Enable Link-Time Optimization reduce binary and increase performance
  • 20. CocoaPods • Manage third-part libraries with CocoaPods download from http://cocoapods.org/ • CocoaPods manage dependency for you it download source files, imports headers and configures flags • It’s like Ruby Gem but for Objective-C! you can search pods, install & update with one command
  • 21. Readme • The Basics Describe what it is that your project makes easier. Provide code examples detailing how the use of the library. Document the installation process. • Don’t get lazy just because this is for developers Technical writing is still writing, and need not be dry and boring. Just as if you were writing an essay or blog post, you should strive to grab the attention of your reader early. This can be easily accomplished with a well-written introductory paragraph. • The code matters Besides speaking English, your readers also understand code. Developers love to see code samples, and a few lines of syntax highlighted source are worth a thousand words. http://robots.thoughtbot.com/post/50852570430/how-to-write-a-great-readme
  • 23. Folders • Put things in the right place ...and everything makes sense, unfortunately, Xcode doesn’t help us • Map all Xcode group folders to file system directories Xcode group folder don’t represent physical folder • Please remove Supporting Files group folder Who wants “Supporting Files” anymore? yuck!
  • 24. My folders structure • Application specific app related stuff like AppDelegate, main.m, .pch etc • Controllers view (.xib) and view controller stuff put together (obviously) • Library specific application classes like helpers, base classes, services, etc
  • 25. My folders structure • Models application domain models and entities, Core Data models too • Resources assets like images, fonts, sounds, videos, etc. • Vendors third part libraries and frameworks (not managed by CocoaPods)
  • 26. Controllers • Put .xib, .h and .m together in the same folders • One (physical) folder for each view controller • If there are too many, group them into a subfolder • Group them by tab (TabBar) or by functions
  • 27. Resources • One folder for each type of asset images, fonts, sounds, videos, strings, plist, samples • One subfolder for each type of image buttons, backgrounds, logos, shapes, icons, app (splash etc.) • If your app support multiple themes, create a hierarchy themes > themes name > images, fonts, etc. • Name image files based on state (if no assets catalog) “button_blue_normal.png”, “button_blue_highlighted.png”, etc.
  • 31. Application • Design (programming) • Layers • Compositions • Best Practices
  • 33. Design • Typically an application is divided into layers A layer is a black box with a contract that define an input and output • To increase the cohesion and decoupling of the software The layers, if well designed, help to decouple and increase the cohesion • Cohesion indicates strongly related software module it would be a subroutine, class or library with common responsibilities • Coupling measure the level of dependency between two software module, such as classes, functions or library
  • 34. Design Principles • Single Responsibility Principle A module should have a single responsibility, and that responsibility should be entirely encapsulated by the module • Open Closed Principle A module should be open for extension but closed for modifications • Liskov’s Substitution Principle Derived types must be completely substitutable for their base types
  • 35. Design Principles • Interface Segregation Principle Clients should not be forced to depend upon interfaces that they don't use • Dependency Inversion Principle High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions • SOLID: the "first five principles" Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion
  • 36. From Principles to Patterns • Design Pattern is a general reusable solution to a commonly occurring problem within a given context • It’s a description or template for how to solve a problem It’s not a finished design that can be transformed into source code • There are many types of design patterns Architectural, Algorithm strategy, Computational, Implementation strategy, Structural, etc.
  • 37. Most Common Design Patterns • Model View Controller Design Pattern It’s a fundamental design pattern in Objective-C. • Singleton Design Pattern For your information the AppDelegate is a singleton • Chain Of Responsibility Design Pattern Have you ever met the Next Responder or the First Responder?
  • 39. Layers • Layer represents a logical section of the system Layer enforce reusability and testability • A typical client/server app have at least 3 layers Presentation Layer, Business Layer and Data Access Layer
  • 40. Layers ! Views ! ! ! Controllers ! Presentation Layer Service ! ! Domain Layer ! Business Layer Persistence Model Layer ! Layer Network ! ! Data Access Layer Layer
  • 42. Presentation Layer • It have 2 components: the UI and the presentation logic in Cocoa the UI is the View and the presentation logic is the (View)Controller • Cocoa adopt Model View Controller Design Pattern the Presentation Layer is already in iOS SDK out-of-the-box • Advanced Appearance Customization with Theme use Appearance Proxy and Theme technique to customize UI.
  • 43. Theme // KMRMTheme.h typedef NS_ENUM(NSInteger, KMRMThemeLabelType) { KMRMThemeLabelTypeArgumentTitle, KMRMThemeLabelTypeArgumentDescription }; ! @protocol KMRMTheme <NSObject> ! - (void)configure; - (void)themeLabel:(UILabel *)label type:(KMRMThemeLabelType)type; ! @end ! ! ! ! // Concrete implementations #import "KMRMTheme.h" ! @interface KMRMDefaultTheme : NSObject<KMRMTheme> @end ! @interface KMRMGreenTheme : NSObject<KMRMTheme> @end
  • 46. Business Layer • It holds the specific app Business Logic and Behaviors It is concerned with the retrieval, processing, transformation, and management of application data; application of business rules and policies • The Domain Model is a conceptual model of business It describes the various entities, their attributes, roles, and relationships, plus the constraints that govern the problem domain • Business Layer gets data through a Service Layer Service Layer defines an application's boundary with a layer of services that establishes a set of available operations and coordinates the application's response in each operation
  • 47. Domain Model Layer • Domain Model An object model of the domain that incorporates both behavior and data • You can use simple Objective-C objects A plain old Objective-C object that inheriting from NSObject • Or you can use Core Data objects you can extend the class NSMangedObject with your Objective-C class
  • 48. Service Layer • Service Layers is a design pattern The benefits a Service Layer provides is that it defines a common set of application operations available to different clients and coordinates the response in each operation. • Service Layer uses Data Access Layer to access data Service Layer uses DAL to performs the task of retrieving and storing data both from server via network and from database • Service Layer is used by ViewController No more a ton of line of codes in your ViewController, instead few lines of simple Service Layer calls
  • 50. Data Access Layer • It’s a layer which provides simplified access to data The data may be stored in a persistent storage like SQLite or in a backend accessible by network • It may uses a Persistence Layer or Network Layer Both exposes a simplify contract to access data
  • 51. Persistence Layer • The persistence layer deals with persisting The persistence layer is responsible for manipulating the database, and it is used by the service layer • You can use Core Data as Persistence Layer Or, in alternative, you can use FMDB for direct access to SQLite
  • 52. Network Layer • Network Layer is responsible of all networking calls • You can use AFNetworking as Network Layer AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of NSURLConnection, NSOperation, and other familiar Foundation technologies
  • 54. Composition • It’s a way to combine objects into more complex ones Compositions are a critical building block of many basic data structures, including the tagged union, the linked list, and the binary tree, as well as the object used in object-oriented programming • In a real-world app composition takes an important role On iOS / OS X App composition is necessary for a good layering and for a structure UI.
  • 55. Composition • Custom Views are an example of composition A custom view is used to manage small portions of the interface in order to recycle the content and its management • In a real-world iOS/OS App there are many custom views For example, all views that must be inserted in a scroll view, or all those portions of the view that occur multiple times in different view and only with different content.
  • 57. General Best Practice • Use Automatic Reference Counting Always use ARC. All new code should be written using ARC, and all legacy code should be updated to use ARC • Use AppDelegate as Singleton Create all common and singleton objects in App Delegate and then expose them by UIResponder Category
  • 58. Coding Best Practices • Create a property for every ivar and use self to access it Always create a @property for every data member and use “self.name” to access it throughout your class implementation • Alway declare “atomic” or “nonatomic” attribute Always use the “nonatomic” attribute on your properties, unless you are writing a thread-safe class and actually need access to be atomic • Use literals and modern Objective-C syntactic sugar The source code will be less verbose and more clear.
  • 59. Presentation Best Practices • Create a base UIViewController Create a MYBaseViewController from which all the view controllers inherit. In this way all the controllers can inherit common behavior. • Create a base UIView Create a MYBaseView from which all the custom views inherit. In this way all the views can inherit common style and appearance • Create a base UITableViewCell Create a MYBaseTableViewCell from which all the custom table view cells inherit. In this way all the cells can inherit common style and appearance
  • 60. Code Design Best Practices • API Design Pay attention to the design of your API. Learn your target platform's conventions before coding. Define the rules that are in accordance with the convention of language • Block and Delegation When should I use blocks instead of delegation for callbacks? Pay attention to this topic and alway look at Apple docs to see how they done
  • 62. Links • Blocks vs Delegation http://thejoeconwayblog.wordpress.com/2012/05/29/blocks-ordelegation/ • API Design http://mattgemmell.com/2012/05/24/api-design/ • Modern Objective-C http://www.slideshare.net/giuseppearici/modern-objectivec-pragma-night
  • 63. Links • objc.io - A periodical about best practices and advanced techniques in Objective-C http://www.objc.io/ • Automatic Reference Counting recap http://www.slideshare.net/giuseppearici/pragma-nightautomaticreferencecounting • How to write a great README http://robots.thoughtbot.com/post/50852570430/how-to-write-a-greatreadme
  • 64. Videos • Customizing the Appearance of UIKit Controls Session 114 - WWDC 2011 Session Videos • Advanced Appearance Customization on iOS Session 216 - WWDC 2012 Session Videos • What’s New in the LLVM Compiler Session 402 - WWDC 2013 Session Videos
  • 65. Books • Cocoa Design Patterns • Erik M. Buck & Donald A. Yacktman • Addison Wesley
  • 66. Books • Patterns Of Enterprise Application Architecture • Martin Fowler • Addison-Wesley Professional • updates: http://martinfowler.com/ books/eaa.html
  • 67. Thank you Massimo Oliviero IT Consultant & Software Developer #pragma mark founder ! ! email massimo.oliviero@gmail.com web www.massimooliviero.net slide www.slideshare.com/MassimoOliviero twitter @maxoly Any questions?