SlideShare uma empresa Scribd logo
1 de 68
INTRODUCTION
to iOS Programming
ME
• Travel & outdoor sports
• Chemical engineering
• Freezer engineering
• Software consultant, technology businesses
• Optometry & Real Estate
ME
• http://calvinx.com
• Twitter @calvinchengx
• FB http://facebook.com/calvin.cheng.lc
• Github http://github.com/calvinchengx
YOU?
WHY?
• Why do we learn programming?
• Why do you want to learn programming?
• What problems do you want to solve?
• Who can we help?
OVERVIEW
• Lesson 1: Introductions
• Lesson 2: iOS specifics
• Lesson 3: Data Model
• Lesson 4: Logic (Controller) & Interface
LESSON 1:
INTRODUCTIONS
• Hour 1 - Demo and Set-up
• Hour 2 - Objective-C Primer
• Hour 3 - MVC Architecture
DEMO
APPLE DEVELOPER
PREREQUISITES
• Do you know an existing programming
language or scripting language?
• Control logic, data and interfaces - what do
you want the user to see and/or do?
• Objective-Oriented Programming?
COMPARISONS
OBJECT-ORIENTED
PROGRAMMING
• Class
• Objects
• Functions
• Methods
KNOW A PROGRAMMING
LANGUAGE?
• C
• Java?
• Javascript?
• Python?
• Ruby?
C-STYLE LANGUAGES
• C
• C++
• Objective-C as a superset of C
• PHP
• C#
• Java
• Perl
OBJECTIVE-C SYNTAX
• @ is used to identify Objective-C
• Special keywords, e.g. protocol, property,
interface, implementation, NSObject,
NSInteger, NSNumber etc
• Tokens, e.g. @, (, ; etc
XCODE: CREATE PROJECT
XCODE: CREATE PROJECT
OBJECTIVE-C PRIMER
• Basic Syntax
• Variables and Data Types
• Working with Objects
• Classes and Objects
• Collections
• Files
• Language Features
• Errors and Debugging
BASIC SYNTAX
• Objective-C is a superset of C programming
language
• i.e. it understands all C syntax
• AND it introduces new syntax of its own on
top of C
BASIC SYNTAX
BASIC SYNTAX
BASIC SYNTAX
Code is grouped into “pairs” of:
• Header file
• Implementation file
BASIC SYNTAX
BASIC SYNTAX
BASIC SYNTAX
VARIABLES & DATA TYPE
myemail@domain.com
#ffffff
37
2008-08-08
VARIABLES & DATA TYPE
myemail@domain.com
#ffffff
37
2008-08-08
email:
color:
age:
date of event:
VARIABLES & DATA TYPE
Javascript
var a = “wonderful”;
a = 123;
a = 1.289;
a = false;
VARIABLES & DATA TYPE
Objective-C
type variable value
int homeworkScore = 87;
VARIABLE & DATA TYPE
Naming convention: camel case
firstName
score
playerKarma
my8Number NOT RECOMMENDED
int_score NOT RECOMMENDED
VARIABLES & DATA TYPE
Primitive Data Types
int
float
double
char
BOOL Objective-C
VARIABLES & DATA TYPE
Composite Data Types
int day = 28;
int month = 11;
int year = 2011;
int secondsSince1970 = 1294909373;
char c1 = ‘h’;
char c2 = ‘e’;
char c3 = ‘l’;
char c4 = ‘l’;
char c5 = ‘o’;
VARIABLES & DATA TYPE
Complex Types: iOS SDK (CocoaTouch
Framework)
NSString *myString = @“Hello”;
NSDate *today = [NSDate date];
WORKING WITH OBJECTS
Procedural Program (Example C program)
WORKING WITH OBJECTS
Object Oriented Programs (Objective-C)
data
logic
data
logic
data
logic
WORKING WITH OBJECTS
class object
CLASS = OBJECT
BLUEPRINT
CLASS = OBJECT
BLUEPRINT
NSDate *today = [NSDate date];
ref -
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl
asses/NSDate_Class/Reference/Reference.html
CLASS = OBJECT
BLUEPRINT
NSDate *today = [NSDate date];
ref -
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl
asses/NSDate_Class/Reference/Reference.html
What’s this?
CLASS = OBJECT
BLUEPRINT
• Pointers!
• All objects are accessed using Pointers
• * represents a pointer and a primitive value
USING OBJECTS
CLASS = OBJECT
BLUEPRINT
NSDate *today = [NSDate date];
ref -
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl
asses/NSDate_Class/Reference/Reference.html
What’s this?
METHODS
NSDate *today = [NSDate date];
ref -
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl
asses/NSDate_Class/Reference/Reference.html
MethodClassType Pointer
denotes that this variable is a Pointer
METHODS
• Class Methods
• Instance Methods (also known as Object
Methods)
METHODS
NSDate *today = [NSDate date]
NSTimeInterval timeInterval = 123;
NSDate *dateFromInterval = [NSDate
dateWithTimeInterval:timeInterval
sinceDate:today]
Class Method
METHODS
NSComparsionResult result = [today
compare:dateFromInterval]
Instance Method
a.k.a. Object Method
NSDate object from previous slide
NSDate object from previous slide
COLLECTIONS
• A group of data or objects
• Various languages refer to them as “arrays”
or “lists” or “dictionaries” or “linked lists”
(each with slightly different underlying
meaning)
COLLECTIONS
FILES
FILES
• All programming languages provide a way to
write to your computer’s/operating system’s
filesystem
• If we cannot put things into a file, the data
that we are working with will not be available
when our computer is switched off since it’s
only in the memory
FILES
LANGUAGE FEATURES
• Inheritance (e.g. NSObject > NSResponder > NSView >
NSControl > NSButton)
• Categories: extending a class with new methods without
sub-classing
LANGUAGE FEATURES
• Class Extensions: extending a class with new
properties without sub-classing (only “.h”
created, no implementation file :-))
LANGUAGE FEATURES
• Categories versus Class Extensions
LANGUAGE FEATURES
• Protocols: a list of methods you want a object to
perform
• required methods
• optional methods
• ANY object can perform those methods
• Think of it as a set/group of methods (“functions”)
LANGUAGE FEATURES
• Dynamic Typing with id
• id is a generic object pointer
ERRORS & DEBUGGING
• Issue navigator
• Pick the first error (don’t start at the bottom)
• Common errors:
• Missing pointer symbol
• Missing semi-colons or braces (parsing error)
• Undeclared identifier (didn’t import a header?)
• Learning to use breakpoints
MVC ARCHITECTURE
• What is MVC?
• Using the iOS Simulator in Xcode
• Exercise Files
• Features of our Note Taking App
WHAT IS MVC?
• Model
• View
• Controller
WHAT IS MVC?
Model
• Representation of your class (“blueprint”, .h, .m)
• Set properties and behaviour of your class
• Set properties and behaviour of your class’ objects
• Handles data storage in memory
• Handles data storage on disk
• Handles data storage to the “cloud”/backend
WHAT IS MVC?
View
• The interface for the user of your app - “Scene”, “Storyboard”
• Listens to user interactions - tap, swipe, other events (shaking
your phone)
• Shows the user responses and ask for user responses
• Aesthetic purpose as well as User function purpose
• Usually tied to the logic (i.e. “controller”)
WHAT IS MVC?
Controller
• “ViewController” (.h, .m)
• Your app should be organised with multiple ViewControllers with
different purposes
• Calls out classes, class methods, objects, object methods from
your models, changes data according to user interactions and
accepts or pushes data to the view
• Using linked to scenes and UI (User Interface) object(s) on a
scene
WHY MVC?
• Organised, modular (cleanly separated code
for easy debugging)
• A convention for teamwork so others can
easily get the “big picture” of the components
that make your app work
IOS SIMULATOR
EXERCISE FILES
• Github url
FEATURES OF OUR NOTE
TAKING APP
• Show list of notes
• Create a note and be able to persist the note
(“save”)
• Edit a note
• Delete a note
WHAT’S NEXT?
• Lesson 1: Introductions
• Lesson 2: iOS specifics
• Lesson 3: Data Model
• Lesson 4: Logic (Controller) & Interface

Mais conteúdo relacionado

Mais procurados

iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development ToolsOmar Cafini
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryAlek Davis
 
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Julie Meloni
 
Development Lifecycle: From Requirement to Release
Development Lifecycle: From Requirement to ReleaseDevelopment Lifecycle: From Requirement to Release
Development Lifecycle: From Requirement to ReleaseJulie Meloni
 
Metaprogramming JavaScript
Metaprogramming  JavaScriptMetaprogramming  JavaScript
Metaprogramming JavaScriptdanwrong
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravelwajrcs
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
Make School 2017 - Mastering iOS Development
Make School 2017 - Mastering iOS DevelopmentMake School 2017 - Mastering iOS Development
Make School 2017 - Mastering iOS DevelopmentMake School
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events WebStackAcademy
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQueryAkshay Mathur
 
An Introduction to Ruby on Rails
An Introduction to Ruby on RailsAn Introduction to Ruby on Rails
An Introduction to Ruby on RailsJoe Fiorini
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentationguest11106b
 

Mais procurados (20)

iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development Tools
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Development Lifecycle: From Requirement to Release
Development Lifecycle: From Requirement to ReleaseDevelopment Lifecycle: From Requirement to Release
Development Lifecycle: From Requirement to Release
 
Metaprogramming JavaScript
Metaprogramming  JavaScriptMetaprogramming  JavaScript
Metaprogramming JavaScript
 
jQuery
jQueryjQuery
jQuery
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravel
 
Automation strategies for agile testing Gaurav bansal
Automation strategies for agile testing  Gaurav bansalAutomation strategies for agile testing  Gaurav bansal
Automation strategies for agile testing Gaurav bansal
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Gourmet Service Object
Gourmet Service ObjectGourmet Service Object
Gourmet Service Object
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
Make School 2017 - Mastering iOS Development
Make School 2017 - Mastering iOS DevelopmentMake School 2017 - Mastering iOS Development
Make School 2017 - Mastering iOS Development
 
[2015/2016] Backbone JS
[2015/2016] Backbone JS[2015/2016] Backbone JS
[2015/2016] Backbone JS
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
 
An Introduction to Ruby on Rails
An Introduction to Ruby on RailsAn Introduction to Ruby on Rails
An Introduction to Ruby on Rails
 
Javascript libraries
Javascript librariesJavascript libraries
Javascript libraries
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 

Semelhante a iOS Beginners Lesson 1

8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
 
CISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development SecurityCISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development SecuritySam Bowne
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development SecuritySam Bowne
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Michael Rys
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersMichael Rys
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTnikshaikh786
 
Sterling for Windows Phone 7
Sterling for Windows Phone 7Sterling for Windows Phone 7
Sterling for Windows Phone 7Jeremy Likness
 
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriarAdf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriarNilesh Shah
 
C++ programming Assignment Help
C++ programming Assignment HelpC++ programming Assignment Help
C++ programming Assignment Helpsmithjonny9876
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Dutyreedmaniac
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyLeslie Doherty
 
A machine learning and data science pipeline for real companies
A machine learning and data science pipeline for real companiesA machine learning and data science pipeline for real companies
A machine learning and data science pipeline for real companiesDataWorks Summit
 
Taming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQLTaming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQLMichael Rys
 

Semelhante a iOS Beginners Lesson 1 (20)

8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
CISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development SecurityCISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development Security
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)Introducing U-SQL (SQLPASS 2016)
Introducing U-SQL (SQLPASS 2016)
 
U-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for DevelopersU-SQL - Azure Data Lake Analytics for Developers
U-SQL - Azure Data Lake Analytics for Developers
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
Sterling for Windows Phone 7
Sterling for Windows Phone 7Sterling for Windows Phone 7
Sterling for Windows Phone 7
 
#CNX14 - Intro to Force
#CNX14 - Intro to Force#CNX14 - Intro to Force
#CNX14 - Intro to Force
 
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriarAdf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
Adf and ala design c sharp corner toronto chapter feb 2019 meetup nik shahriar
 
C++ programming Assignment Help
C++ programming Assignment HelpC++ programming Assignment Help
C++ programming Assignment Help
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Oodb
OodbOodb
Oodb
 
A machine learning and data science pipeline for real companies
A machine learning and data science pipeline for real companiesA machine learning and data science pipeline for real companies
A machine learning and data science pipeline for real companies
 
Taming the shrew Power BI
Taming the shrew Power BITaming the shrew Power BI
Taming the shrew Power BI
 
OOP-1.pptx
OOP-1.pptxOOP-1.pptx
OOP-1.pptx
 
Where to save my data, for devs!
Where to save my data, for devs!Where to save my data, for devs!
Where to save my data, for devs!
 
Taming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQLTaming the Data Science Monster with A New ‘Sword’ – U-SQL
Taming the Data Science Monster with A New ‘Sword’ – U-SQL
 

Mais de Calvin Cheng

FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinFOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinCalvin Cheng
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Calvin Cheng
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Calvin Cheng
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4Calvin Cheng
 
So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?Calvin Cheng
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjangoCalvin Cheng
 
Saving Gaia with GeoDjango
Saving Gaia with GeoDjangoSaving Gaia with GeoDjango
Saving Gaia with GeoDjangoCalvin Cheng
 
Agile Apps with App Engine
Agile Apps with App EngineAgile Apps with App Engine
Agile Apps with App EngineCalvin Cheng
 

Mais de Calvin Cheng (12)

FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinFOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
 
Hashgraph as Code
Hashgraph as CodeHashgraph as Code
Hashgraph as Code
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4
 
So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?
 
Fabric
FabricFabric
Fabric
 
Ladypy 01
Ladypy 01Ladypy 01
Ladypy 01
 
zhng your vim
zhng your vimzhng your vim
zhng your vim
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjango
 
Saving Gaia with GeoDjango
Saving Gaia with GeoDjangoSaving Gaia with GeoDjango
Saving Gaia with GeoDjango
 
Agile Apps with App Engine
Agile Apps with App EngineAgile Apps with App Engine
Agile Apps with App Engine
 

Último

Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 

Último (20)

Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 

iOS Beginners Lesson 1

  • 2. ME • Travel & outdoor sports • Chemical engineering • Freezer engineering • Software consultant, technology businesses • Optometry & Real Estate
  • 3. ME • http://calvinx.com • Twitter @calvinchengx • FB http://facebook.com/calvin.cheng.lc • Github http://github.com/calvinchengx
  • 5. WHY? • Why do we learn programming? • Why do you want to learn programming? • What problems do you want to solve? • Who can we help?
  • 6. OVERVIEW • Lesson 1: Introductions • Lesson 2: iOS specifics • Lesson 3: Data Model • Lesson 4: Logic (Controller) & Interface
  • 7. LESSON 1: INTRODUCTIONS • Hour 1 - Demo and Set-up • Hour 2 - Objective-C Primer • Hour 3 - MVC Architecture
  • 10. PREREQUISITES • Do you know an existing programming language or scripting language? • Control logic, data and interfaces - what do you want the user to see and/or do? • Objective-Oriented Programming?
  • 13. KNOW A PROGRAMMING LANGUAGE? • C • Java? • Javascript? • Python? • Ruby?
  • 14. C-STYLE LANGUAGES • C • C++ • Objective-C as a superset of C • PHP • C# • Java • Perl
  • 15. OBJECTIVE-C SYNTAX • @ is used to identify Objective-C • Special keywords, e.g. protocol, property, interface, implementation, NSObject, NSInteger, NSNumber etc • Tokens, e.g. @, (, ; etc
  • 19. • Basic Syntax • Variables and Data Types • Working with Objects • Classes and Objects • Collections • Files • Language Features • Errors and Debugging
  • 20. BASIC SYNTAX • Objective-C is a superset of C programming language • i.e. it understands all C syntax • AND it introduces new syntax of its own on top of C
  • 23. BASIC SYNTAX Code is grouped into “pairs” of: • Header file • Implementation file
  • 27. VARIABLES & DATA TYPE myemail@domain.com #ffffff 37 2008-08-08
  • 28. VARIABLES & DATA TYPE myemail@domain.com #ffffff 37 2008-08-08 email: color: age: date of event:
  • 29. VARIABLES & DATA TYPE Javascript var a = “wonderful”; a = 123; a = 1.289; a = false;
  • 30. VARIABLES & DATA TYPE Objective-C type variable value int homeworkScore = 87;
  • 31. VARIABLE & DATA TYPE Naming convention: camel case firstName score playerKarma my8Number NOT RECOMMENDED int_score NOT RECOMMENDED
  • 32. VARIABLES & DATA TYPE Primitive Data Types int float double char BOOL Objective-C
  • 33. VARIABLES & DATA TYPE Composite Data Types int day = 28; int month = 11; int year = 2011; int secondsSince1970 = 1294909373; char c1 = ‘h’; char c2 = ‘e’; char c3 = ‘l’; char c4 = ‘l’; char c5 = ‘o’;
  • 34. VARIABLES & DATA TYPE Complex Types: iOS SDK (CocoaTouch Framework) NSString *myString = @“Hello”; NSDate *today = [NSDate date];
  • 35. WORKING WITH OBJECTS Procedural Program (Example C program)
  • 36. WORKING WITH OBJECTS Object Oriented Programs (Objective-C) data logic data logic data logic
  • 39. CLASS = OBJECT BLUEPRINT NSDate *today = [NSDate date]; ref - https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl asses/NSDate_Class/Reference/Reference.html
  • 40. CLASS = OBJECT BLUEPRINT NSDate *today = [NSDate date]; ref - https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl asses/NSDate_Class/Reference/Reference.html What’s this?
  • 41. CLASS = OBJECT BLUEPRINT • Pointers! • All objects are accessed using Pointers • * represents a pointer and a primitive value
  • 43. CLASS = OBJECT BLUEPRINT NSDate *today = [NSDate date]; ref - https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl asses/NSDate_Class/Reference/Reference.html What’s this?
  • 44. METHODS NSDate *today = [NSDate date]; ref - https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Cl asses/NSDate_Class/Reference/Reference.html MethodClassType Pointer denotes that this variable is a Pointer
  • 45. METHODS • Class Methods • Instance Methods (also known as Object Methods)
  • 46. METHODS NSDate *today = [NSDate date] NSTimeInterval timeInterval = 123; NSDate *dateFromInterval = [NSDate dateWithTimeInterval:timeInterval sinceDate:today] Class Method
  • 47. METHODS NSComparsionResult result = [today compare:dateFromInterval] Instance Method a.k.a. Object Method NSDate object from previous slide NSDate object from previous slide
  • 48. COLLECTIONS • A group of data or objects • Various languages refer to them as “arrays” or “lists” or “dictionaries” or “linked lists” (each with slightly different underlying meaning)
  • 50. FILES
  • 51. FILES • All programming languages provide a way to write to your computer’s/operating system’s filesystem • If we cannot put things into a file, the data that we are working with will not be available when our computer is switched off since it’s only in the memory
  • 52. FILES
  • 53. LANGUAGE FEATURES • Inheritance (e.g. NSObject > NSResponder > NSView > NSControl > NSButton) • Categories: extending a class with new methods without sub-classing
  • 54. LANGUAGE FEATURES • Class Extensions: extending a class with new properties without sub-classing (only “.h” created, no implementation file :-))
  • 55. LANGUAGE FEATURES • Categories versus Class Extensions
  • 56. LANGUAGE FEATURES • Protocols: a list of methods you want a object to perform • required methods • optional methods • ANY object can perform those methods • Think of it as a set/group of methods (“functions”)
  • 57. LANGUAGE FEATURES • Dynamic Typing with id • id is a generic object pointer
  • 58. ERRORS & DEBUGGING • Issue navigator • Pick the first error (don’t start at the bottom) • Common errors: • Missing pointer symbol • Missing semi-colons or braces (parsing error) • Undeclared identifier (didn’t import a header?) • Learning to use breakpoints
  • 59. MVC ARCHITECTURE • What is MVC? • Using the iOS Simulator in Xcode • Exercise Files • Features of our Note Taking App
  • 60. WHAT IS MVC? • Model • View • Controller
  • 61. WHAT IS MVC? Model • Representation of your class (“blueprint”, .h, .m) • Set properties and behaviour of your class • Set properties and behaviour of your class’ objects • Handles data storage in memory • Handles data storage on disk • Handles data storage to the “cloud”/backend
  • 62. WHAT IS MVC? View • The interface for the user of your app - “Scene”, “Storyboard” • Listens to user interactions - tap, swipe, other events (shaking your phone) • Shows the user responses and ask for user responses • Aesthetic purpose as well as User function purpose • Usually tied to the logic (i.e. “controller”)
  • 63. WHAT IS MVC? Controller • “ViewController” (.h, .m) • Your app should be organised with multiple ViewControllers with different purposes • Calls out classes, class methods, objects, object methods from your models, changes data according to user interactions and accepts or pushes data to the view • Using linked to scenes and UI (User Interface) object(s) on a scene
  • 64. WHY MVC? • Organised, modular (cleanly separated code for easy debugging) • A convention for teamwork so others can easily get the “big picture” of the components that make your app work
  • 67. FEATURES OF OUR NOTE TAKING APP • Show list of notes • Create a note and be able to persist the note (“save”) • Edit a note • Delete a note
  • 68. WHAT’S NEXT? • Lesson 1: Introductions • Lesson 2: iOS specifics • Lesson 3: Data Model • Lesson 4: Logic (Controller) & Interface