SlideShare a Scribd company logo
1 of 42
How to develop an iOS application
          Objective-C – Xcode – iOS




                                      Le Thanh Quang Mobile tea
                                               April 19th 2012
Agenda


           Objective-C in brief



                          Xcode



               iOS frameworks




         www.exoplatform.com - Copyright 2012 eXo Platform   2
Objective-C




www.exoplatform.com - Copyright 2012 eXo Platform   3
Objective-C – What is it?

Simple extension of the C language


Adds object-oriented capabilities to C language
   Runtime system (C library)
   Dynamic typing
   Dynamic binding


GCC/Clang compiler supports both C and Objective-C
   Apple donated Objective-C for GNU project (open source)




                     www.exoplatform.com - Copyright 2012 eXo Platform   4
Objective-C – Who use?

Apple Inc.


Mac OS X developers
   Cocoa framework
   Core animation, Core data, etc
iOS developers
   Cocoa touch framework
   Core animation, Core data, etc




                     www.exoplatform.com - Copyright 2012 eXo Platform   5
Objective-C – Why should I (Java developer)
care?
Make up your mind with new code designs


iPhone/iPad devices become popular rich user agents in
  enterprise market


eXo Platform 3.5, cloud-workspaces.com are integrated
 with iOS based devices and Android family


Play around for fun or profit in free time ;)




                 www.exoplatform.com - Copyright 2012 eXo Platform   6
Objective-C – History


          Appeared in                                           1983


          Designed by                               Tom Love & Brad Fox


      Major implementations                                GCC, Clang


          Inf uenced by
            l                                              Smalltalk, C


              OS                                         Cross-platform




                 www.exoplatform.com - Copyright 2012 eXo Platform        7
Objective-C and Java

   Java
             Almost everywhere
             … except iPhone




                            Objective-C
  Platform
                                                 Mac OS X
                                                 iPhone, iPad, ...




                www.exoplatform.com - Copyright 2012 eXo Platform    8
Objective-C and Java                                            Message Syntax


Java

                       myString.toString()




Objective-C
              * Square brackets for message expressions

                        [myString description]




                   www.exoplatform.com - Copyright 2012 eXo Platform             9
Objective-C and Java                                        Method arguments

Java

               person.setFirstName(“Fred”)




Objective-C
          * Arguments are delimited by colons

                  [person setFirstName:@”Fred”]




                 www.exoplatform.com - Copyright 2012 eXo Platform             10
Objective-C and Java                                 Object Data types

Java
                 Employee emp = new Employee();



Objective-C

       * Objective-C objects are dynamically allocated structs
           Employee *emp = [[Employee alloc] init];


       * Providing generic object type, id
            id emp2 = [[Employee alloc] init];




                     www.exoplatform.com - Copyright 2012 eXo Platform   11
Objective-C and Java                                    Object Data types

Java
                    * Constructors
                    Employee emp = new Employee();


Objective-C

             Employee *emp = [[Employee alloc] init];

       *   Creation methods are just methods
       *   Calls to super can occur anywhere within a method
       *   Inheritance is straight-forward
       *   Memory allocations and initialization are separate steps




                        www.exoplatform.com - Copyright 2012 eXo Platform   12
Objective-C and Java                           Prefix vs Package path

Java
         java.lang.String s = new String(“hello”);



Objective-C

    * Objective-C doesn't provide namespaces
    * Frameworks and libraries use prefixes by convention to avoid collision

    NSString *s = [NSString alloc] initWithString:@”Hi”];

   ==> NS is prefix for classes of Foundation Framework.




                     www.exoplatform.com - Copyright 2012 eXo Platform         13
Objective-C and Java                             Method prototypes

Java               public void sayHello() {
                      …
                   }


Objective-C

              * Methods declared in .h file, implemented in .m
              * Instance methods prefixed with -
              * Class methods prefixed with +
         Ex:
          // Method declarations
              - (id)init;
              - (id)alloc;




                   www.exoplatform.com - Copyright 2012 eXo Platform   14
Objective-C and Java                              Method prototypes

Objective-C

 * No method overloading
     * Runtime system looks up methods by name rather than signatures

 * Method names can be composed of multiple sections

   Ex:
     - (void)addEmployee:(Employee *)emp withTitle:
 (NSString *)title

     Name of method is addEmployee:withTitle




                    www.exoplatform.com - Copyright 2012 eXo Platform   15
Objective-C and Java                                    Class

Java
                                  ...



Objective-C




              www.exoplatform.com - Copyright 2012 eXo Platform   16
Objective-C and Java             Anatomy of Class Declaration




             www.exoplatform.com - Copyright 2012 eXo Platform   17
Objective-C                              Class Implementation




              www.exoplatform.com - Copyright 2012 eXo Platform   18
Objective-C and Java                                    Class

Java
                                  ...



Objective-C




              www.exoplatform.com - Copyright 2012 eXo Platform   19
Objective-C – Memory management

* Reference counting
   (id)retain; // increase retain count
   (id)release; // decrease retain count
   (id)autorelease; // release with a delay
   (void)dealloc; // call by release when retain count = 1
* Creation methods set retain count to 1
   Creation methods whose names start with alloc or new or contain copy
   Those who call creation methods MUST call either release or
     autorelease also
   Never call dealloc directly




                    www.exoplatform.com - Copyright 2012 eXo Platform     20
Objective-C – Memory management




            www.exoplatform.com - Copyright 2012 eXo Platform   21
Objective-C – Categories




             www.exoplatform.com - Copyright 2012 eXo Platform   22
Objective-C – Using category




             www.exoplatform.com - Copyright 2012 eXo Platform   23
Objective-C – Blocks

A block of code
      A sequence of statements inside {}
      Start with the magical character caret ^

Ex:
[aDictionary enumerateKeysAndObjectsUsingBlock:^(id key,
id value, BOOL *stop) {
        NSLog(@“value for key %@ is %@”, key, value);
        if ([@“ENOUGH” isEqualToString:key]) {
            *stop = YES;
        }
}];



                        www.exoplatform.com - Copyright 2012 eXo Platform   24
Objective-C – Blocks
A block of code
      Can use local variables declared before the block inside the block
      But they are read only!

Ex:
double stopValue = 53.5;
[aDictionary enumerateKeysAndObjectsUsingBlock:^(id key,
id value, BOOL *stop) {
        NSLog(@“value for key %@ is %@”, key, value);
     if ([@“ENOUGH” isEqualToString:key] || ([value
doubleValue] == stopValue)) {
            *stop = YES;
      stoppedEarly = YES; // ILLEGAL
        }
}];                    www.exoplatform.com - Copyright 2012 eXo Platform   25
Objective-C – Blocks
When do we use blocks in iOS?
   Enumeration
   View Animations
   Sorting (sort this thing using a block as the comparison method)
   Notification (when something happens, execute this block)
   Error handlers (if an error happens while doing this, execute this block)
   Completion handlers (when you are done doing this, execute this block)


And a super-important use: Multithreading




                     www.exoplatform.com - Copyright 2012 eXo Platform         26
Xcode




www.exoplatform.com - Copyright 2012 eXo Platform   27
Xcode
IDE for iPhone projects
   Build
   Run (Simulator, device)
   Debug
   Source code management (SCM)
   Documentation




                    www.exoplatform.com - Copyright 2012 eXo Platform   28
Xcode
Automatically maintain build scripts


Display logical grouping of files
   No package paths
   By default, groups not mapped to folder structure
Resources
   Automatically bundled with executable
Frameworks
   Linked at compile time; no classpath needed




                    www.exoplatform.com - Copyright 2012 eXo Platform   29
Xcode - Interface Builder


Visual GUI design tool


Doesn't generate code


Working with “freeze-dried” objects
   Archived (serialized) in .nib files
   Dynamically loaded
   Objects deserialized at load time




                      www.exoplatform.com - Copyright 2012 eXo Platform   30
Xcode




                          DEMO




        www.exoplatform.com - Copyright 2012 eXo Platform   31
iOS




www.exoplatform.com - Copyright 2012 eXo Platform   32
iOS – Layered architecture

C libraries and system calls


Core services (C libraries and Objective-C
frameworks)


Media Layer (C libraries and Objective-C
frameworks)


Cocoa touch
  Foundation framework
  UIKit
              www.exoplatform.com - Copyright 2012 eXo Platform   33
iOS – Design Patterns



                      MVC Pattern



                   Delegate Pattern



                Target/Action Pattern




          www.exoplatform.com - Copyright 2012 eXo Platform   34
iOS – MVC Pattern



      Model                                         View




                      Controller




          www.exoplatform.com - Copyright 2012 eXo Platform   35
iOS – MVC Pattern

Model
  Manages the app data and state
  No concerned with UI or presentation
  Often persists somewhere
  Same model should be reusable, unchanged in different interfaces.




                 www.exoplatform.com - Copyright 2012 eXo Platform    36
iOS – MVC Pattern

View
  Present the Model to the user in an appropriate interface
  Allows user to manipulate data
  Does not store any data
  Easily reusable & configurable to display different data




                  www.exoplatform.com - Copyright 2012 eXo Platform   37
iOS – MVC Pattern

Controller
  Intermediary between Model & View
  Updates the view when the model changes
  Updates the model when the user manipulates the view
  Typically where the app logic lives.




                  www.exoplatform.com - Copyright 2012 eXo Platform   38
iOS – Delegation Pattern
Control passed to delegate objects to perform application
specific behavior


Avoids need to subclass complex objects


Many UIKit classes use delegates
   UIApplication
   UITableView
   UITextField




                   www.exoplatform.com - Copyright 2012 eXo Platform   39
iOS – Target/Action Pattern

 When event occurs, action is invoked on target
object

                                           Target: myObject
     sayHello                              Action: @selector(sayHello)
                                           Event: UIControlEventTouchUpInside




                                                                    Controller

                www.exoplatform.com - Copyright 2012 eXo Platform                40
References



Training for newcomer of Mobile team -
http://int.exoplatform.org/portal/g/:spaces:mobile/mobile/local._wiki.WikiPortl
et/group/spaces/mobile/iOS_Training



Jonathan Lehr -
http://jonathanlehr.files.wordpress.com/2009/09/objective-c-and-java.pdf



stanford.edu - http://www.stanford.edu/class/cs193p/cgi-bin/drupal/




                     www.exoplatform.com - Copyright 2012 eXo Platform            41
Questions?




www.exoplatform.com - Copyright 2012 eXo Platform   42

More Related Content

Viewers also liked

Android Application Development at JFokus 2011
Android Application Development at JFokus 2011Android Application Development at JFokus 2011
Android Application Development at JFokus 2011Anders Göransson
 
Life Cycle of an iPhone App
Life Cycle of an iPhone AppLife Cycle of an iPhone App
Life Cycle of an iPhone AppJohn McKerrell
 
iOS Multithreading
iOS MultithreadingiOS Multithreading
iOS MultithreadingRicha Jain
 
iOS Developer Interview Questions
iOS Developer Interview QuestionsiOS Developer Interview Questions
iOS Developer Interview QuestionsClark Davidson
 
Effective presentation skills
Effective presentation skillsEffective presentation skills
Effective presentation skillsbiadoll123
 
Good PowerPoint Design - for business presenters
Good PowerPoint Design - for business presentersGood PowerPoint Design - for business presenters
Good PowerPoint Design - for business presentersAlexander Osterwalder
 
iOS Application Lifecycle
iOS Application LifecycleiOS Application Lifecycle
iOS Application LifecycleSiva Prasad K V
 
10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next PresentationSOAP Presentations
 

Viewers also liked (11)

Android Application Development at JFokus 2011
Android Application Development at JFokus 2011Android Application Development at JFokus 2011
Android Application Development at JFokus 2011
 
Life Cycle of an iPhone App
Life Cycle of an iPhone AppLife Cycle of an iPhone App
Life Cycle of an iPhone App
 
iOS Multithreading
iOS MultithreadingiOS Multithreading
iOS Multithreading
 
iOS Design Patterns
iOS Design PatternsiOS Design Patterns
iOS Design Patterns
 
iOS Developer Interview Questions
iOS Developer Interview QuestionsiOS Developer Interview Questions
iOS Developer Interview Questions
 
Architecting iOS Project
Architecting iOS ProjectArchitecting iOS Project
Architecting iOS Project
 
Effective presentation skills
Effective presentation skillsEffective presentation skills
Effective presentation skills
 
Good PowerPoint Design - for business presenters
Good PowerPoint Design - for business presentersGood PowerPoint Design - for business presenters
Good PowerPoint Design - for business presenters
 
iOS Application Lifecycle
iOS Application LifecycleiOS Application Lifecycle
iOS Application Lifecycle
 
10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation10 Powerful Body Language Tips for your next Presentation
10 Powerful Body Language Tips for your next Presentation
 
How Google Works
How Google WorksHow Google Works
How Google Works
 

Similar to How to develop an iOS application

Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebelMinh Hoang
 
Ios fundamentals with ObjectiveC
Ios fundamentals with ObjectiveCIos fundamentals with ObjectiveC
Ios fundamentals with ObjectiveCMadusha Perera
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)Netcetera
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTAtit Patumvan
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
javagruppen.dk - e4, the next generation Eclipse platform
javagruppen.dk - e4, the next generation Eclipse platformjavagruppen.dk - e4, the next generation Eclipse platform
javagruppen.dk - e4, the next generation Eclipse platformTonny Madsen
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmJameel Nabbo
 
OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?Antonio García-Domínguez
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developersgeorgebrock
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to DistributionTunvir Rahman Tusher
 
Find your own iOS kernel bug
Find your own iOS kernel bugFind your own iOS kernel bug
Find your own iOS kernel bugGustavo Martinez
 
Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012jobandesther
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studiobryan costanich
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction paramisoft
 
CRaSH: the shell for the Java Platform
CRaSH: the shell for the Java PlatformCRaSH: the shell for the Java Platform
CRaSH: the shell for the Java Platformjviet
 

Similar to How to develop an iOS application (20)

Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebel
 
Ios fundamentals with ObjectiveC
Ios fundamentals with ObjectiveCIos fundamentals with ObjectiveC
Ios fundamentals with ObjectiveC
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDT
 
Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - C
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
javagruppen.dk - e4, the next generation Eclipse platform
javagruppen.dk - e4, the next generation Eclipse platformjavagruppen.dk - e4, the next generation Eclipse platform
javagruppen.dk - e4, the next generation Eclipse platform
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 
OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?
 
Cocoa for Web Developers
Cocoa for Web DevelopersCocoa for Web Developers
Cocoa for Web Developers
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Find your own iOS kernel bug
Find your own iOS kernel bugFind your own iOS kernel bug
Find your own iOS kernel bug
 
Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012Code and Conquer with Globe Labs, October 27, 2012
Code and Conquer with Globe Labs, October 27, 2012
 
Cross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual StudioCross-Platform Mobile Development in Visual Studio
Cross-Platform Mobile Development in Visual Studio
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction
 
CRaSH: the shell for the Java Platform
CRaSH: the shell for the Java PlatformCRaSH: the shell for the Java Platform
CRaSH: the shell for the Java Platform
 

Recently uploaded

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 

Recently uploaded (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 

How to develop an iOS application

  • 1. How to develop an iOS application Objective-C – Xcode – iOS Le Thanh Quang Mobile tea April 19th 2012
  • 2. Agenda Objective-C in brief Xcode iOS frameworks www.exoplatform.com - Copyright 2012 eXo Platform 2
  • 4. Objective-C – What is it? Simple extension of the C language Adds object-oriented capabilities to C language Runtime system (C library) Dynamic typing Dynamic binding GCC/Clang compiler supports both C and Objective-C Apple donated Objective-C for GNU project (open source) www.exoplatform.com - Copyright 2012 eXo Platform 4
  • 5. Objective-C – Who use? Apple Inc. Mac OS X developers Cocoa framework Core animation, Core data, etc iOS developers Cocoa touch framework Core animation, Core data, etc www.exoplatform.com - Copyright 2012 eXo Platform 5
  • 6. Objective-C – Why should I (Java developer) care? Make up your mind with new code designs iPhone/iPad devices become popular rich user agents in enterprise market eXo Platform 3.5, cloud-workspaces.com are integrated with iOS based devices and Android family Play around for fun or profit in free time ;) www.exoplatform.com - Copyright 2012 eXo Platform 6
  • 7. Objective-C – History Appeared in 1983 Designed by Tom Love & Brad Fox Major implementations GCC, Clang Inf uenced by l Smalltalk, C OS Cross-platform www.exoplatform.com - Copyright 2012 eXo Platform 7
  • 8. Objective-C and Java Java Almost everywhere … except iPhone Objective-C Platform Mac OS X iPhone, iPad, ... www.exoplatform.com - Copyright 2012 eXo Platform 8
  • 9. Objective-C and Java Message Syntax Java myString.toString() Objective-C * Square brackets for message expressions [myString description] www.exoplatform.com - Copyright 2012 eXo Platform 9
  • 10. Objective-C and Java Method arguments Java person.setFirstName(“Fred”) Objective-C * Arguments are delimited by colons [person setFirstName:@”Fred”] www.exoplatform.com - Copyright 2012 eXo Platform 10
  • 11. Objective-C and Java Object Data types Java Employee emp = new Employee(); Objective-C * Objective-C objects are dynamically allocated structs Employee *emp = [[Employee alloc] init]; * Providing generic object type, id id emp2 = [[Employee alloc] init]; www.exoplatform.com - Copyright 2012 eXo Platform 11
  • 12. Objective-C and Java Object Data types Java * Constructors Employee emp = new Employee(); Objective-C Employee *emp = [[Employee alloc] init]; * Creation methods are just methods * Calls to super can occur anywhere within a method * Inheritance is straight-forward * Memory allocations and initialization are separate steps www.exoplatform.com - Copyright 2012 eXo Platform 12
  • 13. Objective-C and Java Prefix vs Package path Java java.lang.String s = new String(“hello”); Objective-C * Objective-C doesn't provide namespaces * Frameworks and libraries use prefixes by convention to avoid collision NSString *s = [NSString alloc] initWithString:@”Hi”]; ==> NS is prefix for classes of Foundation Framework. www.exoplatform.com - Copyright 2012 eXo Platform 13
  • 14. Objective-C and Java Method prototypes Java public void sayHello() { … } Objective-C * Methods declared in .h file, implemented in .m * Instance methods prefixed with - * Class methods prefixed with + Ex: // Method declarations - (id)init; - (id)alloc; www.exoplatform.com - Copyright 2012 eXo Platform 14
  • 15. Objective-C and Java Method prototypes Objective-C * No method overloading * Runtime system looks up methods by name rather than signatures * Method names can be composed of multiple sections Ex: - (void)addEmployee:(Employee *)emp withTitle: (NSString *)title Name of method is addEmployee:withTitle www.exoplatform.com - Copyright 2012 eXo Platform 15
  • 16. Objective-C and Java Class Java ... Objective-C www.exoplatform.com - Copyright 2012 eXo Platform 16
  • 17. Objective-C and Java Anatomy of Class Declaration www.exoplatform.com - Copyright 2012 eXo Platform 17
  • 18. Objective-C Class Implementation www.exoplatform.com - Copyright 2012 eXo Platform 18
  • 19. Objective-C and Java Class Java ... Objective-C www.exoplatform.com - Copyright 2012 eXo Platform 19
  • 20. Objective-C – Memory management * Reference counting (id)retain; // increase retain count (id)release; // decrease retain count (id)autorelease; // release with a delay (void)dealloc; // call by release when retain count = 1 * Creation methods set retain count to 1 Creation methods whose names start with alloc or new or contain copy Those who call creation methods MUST call either release or autorelease also Never call dealloc directly www.exoplatform.com - Copyright 2012 eXo Platform 20
  • 21. Objective-C – Memory management www.exoplatform.com - Copyright 2012 eXo Platform 21
  • 22. Objective-C – Categories www.exoplatform.com - Copyright 2012 eXo Platform 22
  • 23. Objective-C – Using category www.exoplatform.com - Copyright 2012 eXo Platform 23
  • 24. Objective-C – Blocks A block of code A sequence of statements inside {} Start with the magical character caret ^ Ex: [aDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { NSLog(@“value for key %@ is %@”, key, value); if ([@“ENOUGH” isEqualToString:key]) { *stop = YES; } }]; www.exoplatform.com - Copyright 2012 eXo Platform 24
  • 25. Objective-C – Blocks A block of code Can use local variables declared before the block inside the block But they are read only! Ex: double stopValue = 53.5; [aDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id value, BOOL *stop) { NSLog(@“value for key %@ is %@”, key, value); if ([@“ENOUGH” isEqualToString:key] || ([value doubleValue] == stopValue)) { *stop = YES; stoppedEarly = YES; // ILLEGAL } }]; www.exoplatform.com - Copyright 2012 eXo Platform 25
  • 26. Objective-C – Blocks When do we use blocks in iOS? Enumeration View Animations Sorting (sort this thing using a block as the comparison method) Notification (when something happens, execute this block) Error handlers (if an error happens while doing this, execute this block) Completion handlers (when you are done doing this, execute this block) And a super-important use: Multithreading www.exoplatform.com - Copyright 2012 eXo Platform 26
  • 28. Xcode IDE for iPhone projects Build Run (Simulator, device) Debug Source code management (SCM) Documentation www.exoplatform.com - Copyright 2012 eXo Platform 28
  • 29. Xcode Automatically maintain build scripts Display logical grouping of files No package paths By default, groups not mapped to folder structure Resources Automatically bundled with executable Frameworks Linked at compile time; no classpath needed www.exoplatform.com - Copyright 2012 eXo Platform 29
  • 30. Xcode - Interface Builder Visual GUI design tool Doesn't generate code Working with “freeze-dried” objects Archived (serialized) in .nib files Dynamically loaded Objects deserialized at load time www.exoplatform.com - Copyright 2012 eXo Platform 30
  • 31. Xcode DEMO www.exoplatform.com - Copyright 2012 eXo Platform 31
  • 32. iOS www.exoplatform.com - Copyright 2012 eXo Platform 32
  • 33. iOS – Layered architecture C libraries and system calls Core services (C libraries and Objective-C frameworks) Media Layer (C libraries and Objective-C frameworks) Cocoa touch Foundation framework UIKit www.exoplatform.com - Copyright 2012 eXo Platform 33
  • 34. iOS – Design Patterns MVC Pattern Delegate Pattern Target/Action Pattern www.exoplatform.com - Copyright 2012 eXo Platform 34
  • 35. iOS – MVC Pattern Model View Controller www.exoplatform.com - Copyright 2012 eXo Platform 35
  • 36. iOS – MVC Pattern Model Manages the app data and state No concerned with UI or presentation Often persists somewhere Same model should be reusable, unchanged in different interfaces. www.exoplatform.com - Copyright 2012 eXo Platform 36
  • 37. iOS – MVC Pattern View Present the Model to the user in an appropriate interface Allows user to manipulate data Does not store any data Easily reusable & configurable to display different data www.exoplatform.com - Copyright 2012 eXo Platform 37
  • 38. iOS – MVC Pattern Controller Intermediary between Model & View Updates the view when the model changes Updates the model when the user manipulates the view Typically where the app logic lives. www.exoplatform.com - Copyright 2012 eXo Platform 38
  • 39. iOS – Delegation Pattern Control passed to delegate objects to perform application specific behavior Avoids need to subclass complex objects Many UIKit classes use delegates UIApplication UITableView UITextField www.exoplatform.com - Copyright 2012 eXo Platform 39
  • 40. iOS – Target/Action Pattern When event occurs, action is invoked on target object Target: myObject sayHello Action: @selector(sayHello) Event: UIControlEventTouchUpInside Controller www.exoplatform.com - Copyright 2012 eXo Platform 40
  • 41. References Training for newcomer of Mobile team - http://int.exoplatform.org/portal/g/:spaces:mobile/mobile/local._wiki.WikiPortl et/group/spaces/mobile/iOS_Training Jonathan Lehr - http://jonathanlehr.files.wordpress.com/2009/09/objective-c-and-java.pdf stanford.edu - http://www.stanford.edu/class/cs193p/cgi-bin/drupal/ www.exoplatform.com - Copyright 2012 eXo Platform 41

Editor's Notes

  1. Objective-C in brief Xcode MVC, Delegate and action-target patterns Cocoa Touch Frameworks Blocks, multithreading, categories
  2. * Objective-C is a superset of C Objective-C, being a C derivative, inherits all of C's features. There are a few exceptions but they don't really deviate from what C offers as a language. * Likewise, the language can be implemented on top of existing C compilers (in GCC, first as a preprocessor, then as a module) rather than as a new compiler. This allows Objective-C to leverage the huge existing collection of C code, libraries, tools, etc. Existing C libraries can be wrapped in Objective-C wrappers to provide an OO-style interface. In this aspect, it is similar to GObject library and Vala language, which are widely used in development of GTK applications. * Starting in 2005, Apple has made extensive use of LLVM in a number of commercial systems,[4] including the iPhone development kit and Xcode 3.1.
  3. * Today, objective-C is used primarily on Apple's Mac OS X and iOS * It is the primary language used for Apple's Cocoa API *
  4. Watch a video illustrate how to create an iOS application by Xcode
  5. Watch a video illustrate how to create an iOS application by Xcode