Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Intro to iOS Development • Made by Many
In This Deck 
MVC Architecture 
Objective-C Syntax 
Classes 
Instances 
Methods 
Properties 
Setters + Getters 
Header + Implementation 
Delegates + Protocols 
Xcode IDE 
Key Classes + Terms In Objective-C 
This deck is shared with you under a Creative Commons license.
Cloud Services User Input 
Model 
Coordinates between model and view 
Contains all application logic and data 
View 
Your application’s graphical user interface 
View Controller 
The MVC architecture is useful because it lets you abstract apart and organize your app into functional, 
replaceable modules. 
NSNotification 
MVC Architecture 
(Model + View + Controller)
MVC Architecture 
(Model + View + Controller) 
Model View Result 
+ = 
Tic Tac Toe Visual 
Tic Tac Toe Textual 
X played: (2, 3) 
O played: (3, 1) 
X played: (1, 3) 
SMS Textual 
Chris said: CoD? 
Adam said: nm, u? 
HJ said: sup 
same model • different view 
different model • same view
Objective-C 
Syntax 
[[Vehicle alloc] initWithMake:@“Toyota” model:@“Prius” color:[UIColor blackColor]]; 
Objective-C is a verbose language. 
Method names and variable names tend to be very long. 
This is supposed to make it easier to understand your code and how to use methods.
Objective-C 
Syntax 
Objective-C is an object-oriented language. 
Methods are really “messages” send to objects or classes telling them to do things. 
For example: 
[myCar setSpeed:50.0]; 
is really saying: 
“Tell myCar to set its speed to 50.0 mph.” 
50.0 mph, 
please!
Objective-C 
Syntax 
Xcode will attempt to autocomplete whatever you’re typing. 
This not only helps you save time (you can hit Tab to autocomplete) but also helps you discover relevant 
methods and properties.
Objective-C 
Classes 
Vehicle myCar yourCar 
> make @“Toyota” @“Lamborghini” 
> model @“Prius” @“Aventador” 
> speed 50.0 95.0 
Think of a class as a category, e.g., Vehicle. 
A class has no data but can perform some basic methods. 
A class also specifies what properties instances of that class should have. 
It’s kind of like a form that hasn’t been filled out. 
E.g., Vehicle might have properties for make, model, and speed.
Objective-C 
Classes 
Vehicle 
Car Truck Motorcycle 
All classes in Objective-C inherit some methods and properties from a superclass. 
As a result, each class is a subclass of another class. 
E.g., Vehicle might be a subclass of NSObject and might have its own subclasses Car, Truck, and 
Motorcycle that have all the properties and methods of Vehicles but also add their own properties and 
methods.
Objective-C 
Instances 
An instance is a specific instance of a class. 
E.g., myCar might be an instance of Car. 
An instance has data and may have some methods that you can perform on that data. 
E.g., For myCar, you would have the following values for your properties: 
myCar.make = @“Toyota”; 
myCar.model = @“Prius”; 
myCar.speed = 55.0; 
myCar.gas = 10.0; 
myCar.owner = @“Ken M. Haggerty”; 
Instances are often created using alloc and init, e.g.: 
[[Car alloc] init]; 
or using a “convenience” method, e.g.: 
[Car carWithOwner:@“Ken M. Haggerty”];
Objective-C 
Methods 
A class method is a method that is performed on a class rather than a specific instance of a class. 
Class methods are often useful for instantiation and general methods not specific to instances. 
E.g., [NSArray arrayWithObject:firstObject] creates a new array with one object in it, 
or, [TicTacToe howManyInARowToWin] might return 3. 
An instance method is a method that is performed on an instance of a class. 
Instance methods are useful for changing or manipulating instances of your class. 
E.g., If myString is set to @“filename”, 
[myString stringbyAppendingString:@“.png”] would return the string @“filename.png”.
Objective-C 
Properties 
Properties are how data are stored in instances of your class. 
They are like fields on a form. 
Each property defines what kind of data it should hold, but only instances of your class actually hold that 
data. 
E.g., Car might have the property 
@property (nonatomic) BOOL isNewCar; 
while myCar, an instance of Car, might have isNewCar set to NO.
Objective-C 
Setters + Getters 
When you create a property, Objective-C will automatically create helper methods for accessing and setting 
values for your property. 
I.e., When you create: 
@property (nonatomic, strong) NSString *owner; 
Objective-C will create the following two instance methods for you: 
- (void)setOwner:(NSString *)owner; 
- (NSString *)owner; 
Both of these methods are accessible to you as soon as you define your property. 
However, you can always write your own custom implementation for your helper and/or getter.
Objective-C 
Setters + Getters 
Setters are only called when that property is being set explicitly, e.g.: 
[myCar setOwner:@“Ken M. Haggerty”]; 
myCar.owner = @“Ken M. Haggerty”; 
Getters can be called in either of the following ways: 
[usa name]; 
usa.name; 
The second syntax in each of the above examples is called dot notation and is usually only used for 
properties in Objective-C.
Objective-C 
Header + Implementation Files 
“Burger, please!” 
(returns burger) 
<YourClass>.h 
Dictates public interface for this class; i.e., how other 
classes can and should interact with this class. 
● Imports (#import) 
● Protocols (@protocol) 
● Public API (@interface) 
<YourClass>.m 
Dictates private interface for this class + contains all 
method implementations for this class. 
● Imports (#import) 
● Private API (@interface) 
● Implementation (@implementation) 
In Objective-C, the header (.h) file is “public” while the implementation file (.m) is “private.” 
The header file should be organized, clear, and state what the class does and how to use it.
Objective-C 
Delegates + Protocols 
In well-written Objective-C, your model and your view are completely agnostic of each other. 
I.e., Your model should not be in any way dependent on how it is ultimately presented to the user, and your 
view should not care what kind of data it is representing. 
Instead, your model and view should communicate using the following relationships: 
● Your view controller can change your model. 
● Your model can change itself. 
● Your model can send out notifications when it is changed. 
● Your view controller can listen for notifications and act accordingly. 
● Your view controller can change your view. 
To do this, we often used delegates to delegate methods and properties from view controllers to models. 
E.g., UITableViewController has two delegates: delegate and dataSource. 
When assigning delegates, we can ensure that our delegates implement the necessary properties and 
methods by specifying protocols that they should follow. 
We can dictate what protocols a property should follow when defining them. E.g.: 
@property (nonatomic, weak) id <MyProtocol> delegate;
Xcode IDE 
(Integrated Development Environment) 
Demo 
There’s a lot going on in Xcode, so we’ll explore by clicking around. 
If you have trouble using Xcode or have any questions, don’t hesitate! Ken will be happy to help.
Objective-C 
Key Classes + Terms 
NSObject or id: Top-level object in Objective-C. Almost all objects in Objective-C inherit 
from NSObject. 
UIViewController: A basic view controller in Objective-C. All view controllers inherit from 
UIViewController. 
UIView: A basic view in Objective-C. Views are always rectangles. All views inherit from 
UIView. Views can be placed as subviews within another view. 
UIButton: A basic button in Objective-C. Buttons can respond to touch events. 
UIImage: An image in Objective-C. 
UIImageView: A subclass of UIView designed for displaying an image. 
UIScrollView: A subclass of UIView designed for scrolling content. Scrollviews are tricky 
but incredibly useful. 
IBOutlet / IBAction: Designates that a property / method should be connected to a view 
via Interface Builder. 
nonatomic / atomic: You will always use nonatomic. This has to do with thread safety 
regarding setters and getters for properties. 
strong / weak: Determines whether a property’s value should be held even if no other 
object is pointing to that value. Strong = yes, weak = no. 
self: Used within an instance method to refer to the instance the method was sent to. 
Interface Builder / Storyboard: Visual interface within Xcode IDE for laying out and 
creating your app’s GUI. 
UITableViewController: A subclass of UIScrollView designed for presenting scrollable 
tables. 
UITableView: A subclass of UIScrollView designed for presenting scrollable tables. 
UITableViewCell: A subclass of UIView designed for presenting content in tables. 
UITableViewCells are reused as the table view is scrolled, increasing responsivity and 
smoothness. 
NSArray: A subclass of NSObject that contains an uneditable list of NSObjects. 
NSMutableArray: A subclass of NSArray where its list of NSObjects are editable. 
NSString: A subclass of NSObject for text. 
BOOL: A binary type that’s actually just plain C. Can have value YES or NO. 
int: A C class for storing integer values. 
float: A C class for storing floats (i.s., decimal values). 
#import: Add a library, framework, or another class to the current class. 
Apple has very thorough documentation available from within Xcode at Help > Documentation and API Reference 
and online at https://developer.apple.com/library/ios/navigation/

More Related Content

What's hot

Classes2
Classes2Classes2
Classes2
phanleson
 
Java beans
Java beansJava beans
Java beans
Bipin Bedi
 
C++ to java
C++ to javaC++ to java
constructor and destructor-object oriented programming
constructor and destructor-object oriented programmingconstructor and destructor-object oriented programming
constructor and destructor-object oriented programming
Ashita Agrawal
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Pavith Gunasekara
 
Objective c
Objective cObjective c
Objective c
ricky_chatur2005
 
Introduction to php oop
Introduction to php oopIntroduction to php oop
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
bindur87
 
object oriented programming language by c++
object oriented programming language by c++object oriented programming language by c++
object oriented programming language by c++
Mohamad Al_hsan
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
lykado0dles
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
Ilio Catallo
 
Structural pattern 3
Structural pattern 3Structural pattern 3
Structural pattern 3
Naga Muruga
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
Usman Mehmood
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor
suraj pandey
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
Haresh Jaiswal
 
Mca 2nd sem u-2 classes & objects
Mca 2nd  sem u-2 classes & objectsMca 2nd  sem u-2 classes & objects
Mca 2nd sem u-2 classes & objects
Rai University
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
Muhammad Younis
 
Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11
Niit Care
 
Constructor
ConstructorConstructor
Constructor
abhay singh
 
Methods and constructors in java
Methods and constructors in javaMethods and constructors in java
Methods and constructors in java
baabtra.com - No. 1 supplier of quality freshers
 

What's hot (20)

Classes2
Classes2Classes2
Classes2
 
Java beans
Java beansJava beans
Java beans
 
C++ to java
C++ to javaC++ to java
C++ to java
 
constructor and destructor-object oriented programming
constructor and destructor-object oriented programmingconstructor and destructor-object oriented programming
constructor and destructor-object oriented programming
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Objective c
Objective cObjective c
Objective c
 
Introduction to php oop
Introduction to php oopIntroduction to php oop
Introduction to php oop
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
object oriented programming language by c++
object oriented programming language by c++object oriented programming language by c++
object oriented programming language by c++
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
Structural pattern 3
Structural pattern 3Structural pattern 3
Structural pattern 3
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
 
vb.net Constructor and destructor
vb.net Constructor and destructorvb.net Constructor and destructor
vb.net Constructor and destructor
 
04. constructor & destructor
04. constructor & destructor04. constructor & destructor
04. constructor & destructor
 
Mca 2nd sem u-2 classes & objects
Mca 2nd  sem u-2 classes & objectsMca 2nd  sem u-2 classes & objects
Mca 2nd sem u-2 classes & objects
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
 
Ado.net session11
Ado.net session11Ado.net session11
Ado.net session11
 
Constructor
ConstructorConstructor
Constructor
 
Methods and constructors in java
Methods and constructors in javaMethods and constructors in java
Methods and constructors in java
 

Similar to Intro to iOS Development • Made by Many

Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
Vu Tran Lam
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
NicheTech Com. Solutions Pvt. Ltd.
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
NicheTech Com. Solutions Pvt. Ltd.
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
Preetha Ganapathi
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
Amr Elghadban (AmrAngry)
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
Ajay Chimmani
 
201005 accelerometer and core Location
201005 accelerometer and core Location201005 accelerometer and core Location
201005 accelerometer and core Location
Javier Gonzalez-Sanchez
 
Object Oriented Programming (Advanced )
Object Oriented Programming   (Advanced )Object Oriented Programming   (Advanced )
Object Oriented Programming (Advanced )
ayesha420248
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction
paramisoft
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
Sunny Shaikh
 
Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1
LK394
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
Connex
 
CSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+ReflectionCSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+Reflection
Mohammad Shaker
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
Milind Patil
 
OOP and C++Classes
OOP and C++ClassesOOP and C++Classes
OOP and C++Classes
MuhammadHuzaifa981023
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
Compare Infobase Limited
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
Amr Elghadban (AmrAngry)
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
Connex
 

Similar to Intro to iOS Development • Made by Many (20)

Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Angular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advancedAngular Framework ppt for beginners and advanced
Angular Framework ppt for beginners and advanced
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
 
201005 accelerometer and core Location
201005 accelerometer and core Location201005 accelerometer and core Location
201005 accelerometer and core Location
 
Object Oriented Programming (Advanced )
Object Oriented Programming   (Advanced )Object Oriented Programming   (Advanced )
Object Oriented Programming (Advanced )
 
iOS development introduction
iOS development introduction iOS development introduction
iOS development introduction
 
Introduction to objective c
Introduction to objective cIntroduction to objective c
Introduction to objective c
 
Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
CSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+ReflectionCSharp Advanced L05-Attributes+Reflection
CSharp Advanced L05-Attributes+Reflection
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
 
OOP and C++Classes
OOP and C++ClassesOOP and C++Classes
OOP and C++Classes
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 

Recently uploaded

YouTube SEO Mastery ......................
YouTube SEO Mastery ......................YouTube SEO Mastery ......................
YouTube SEO Mastery ......................
islamiato717
 
BoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and DebuggerBoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and Debugger
Ortus Solutions, Corp
 
Top 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your WebsiteTop 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your Website
e-Definers Technology
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
Ortus Solutions, Corp
 
Java SE 17 Study Guide for Certification - Chapter 01
Java SE 17 Study Guide for Certification - Chapter 01Java SE 17 Study Guide for Certification - Chapter 01
Java SE 17 Study Guide for Certification - Chapter 01
williamrobertherman
 
Web Hosting with CommandBox and CommandBox Pro
Web Hosting with CommandBox and CommandBox ProWeb Hosting with CommandBox and CommandBox Pro
Web Hosting with CommandBox and CommandBox Pro
Ortus Solutions, Corp
 
Securing Your Application with Passkeys and cbSecurity
Securing Your Application with Passkeys and cbSecuritySecuring Your Application with Passkeys and cbSecurity
Securing Your Application with Passkeys and cbSecurity
Ortus Solutions, Corp
 
dachnug51 - HCL Domino Roadmap .pdf
dachnug51 - HCL Domino Roadmap      .pdfdachnug51 - HCL Domino Roadmap      .pdf
dachnug51 - HCL Domino Roadmap .pdf
DNUG e.V.
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
Ortus Solutions, Corp
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
TwisterTools
 
NLJUG speaker academy 2024 - session 1, June 2024
NLJUG speaker academy 2024 - session 1, June 2024NLJUG speaker academy 2024 - session 1, June 2024
NLJUG speaker academy 2024 - session 1, June 2024
Bert Jan Schrijver
 
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
Ortus Solutions, Corp
 
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile ServiceMumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
kolkata dolls
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
Ortus Solutions, Corp
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
MaisnamLuwangPibarel
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
Online eMenu
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
AUGNYC
 
How to Break Your App with Playwright Tests
How to Break Your App with Playwright TestsHow to Break Your App with Playwright Tests
How to Break Your App with Playwright Tests
Ortus Solutions, Corp
 

Recently uploaded (20)

YouTube SEO Mastery ......................
YouTube SEO Mastery ......................YouTube SEO Mastery ......................
YouTube SEO Mastery ......................
 
BoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and DebuggerBoxLang Developer Tooling: VSCode Extension and Debugger
BoxLang Developer Tooling: VSCode Extension and Debugger
 
Top 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your WebsiteTop 10 Tips To Get Google AdSense For Your Website
Top 10 Tips To Get Google AdSense For Your Website
 
Migrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS CloudMigrate your Infrastructure to the AWS Cloud
Migrate your Infrastructure to the AWS Cloud
 
Java SE 17 Study Guide for Certification - Chapter 01
Java SE 17 Study Guide for Certification - Chapter 01Java SE 17 Study Guide for Certification - Chapter 01
Java SE 17 Study Guide for Certification - Chapter 01
 
Web Hosting with CommandBox and CommandBox Pro
Web Hosting with CommandBox and CommandBox ProWeb Hosting with CommandBox and CommandBox Pro
Web Hosting with CommandBox and CommandBox Pro
 
Securing Your Application with Passkeys and cbSecurity
Securing Your Application with Passkeys and cbSecuritySecuring Your Application with Passkeys and cbSecurity
Securing Your Application with Passkeys and cbSecurity
 
dachnug51 - HCL Domino Roadmap .pdf
dachnug51 - HCL Domino Roadmap      .pdfdachnug51 - HCL Domino Roadmap      .pdf
dachnug51 - HCL Domino Roadmap .pdf
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
 
NLJUG speaker academy 2024 - session 1, June 2024
NLJUG speaker academy 2024 - session 1, June 2024NLJUG speaker academy 2024 - session 1, June 2024
NLJUG speaker academy 2024 - session 1, June 2024
 
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
ColdBox Debugger v4.2.0: Unveiling Advanced Debugging Techniques for ColdBox ...
 
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile ServiceMumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
Mumbai @Call @Girls Whatsapp 9930687706 With High Profile Service
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
How to debug ColdFusion Applications using “ColdFusion Builder extension for ...
 
Development of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML TechnologiesDevelopment of Chatbot Using AI\ML Technologies
Development of Chatbot Using AI\ML Technologies
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
 
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
Revolutionize Dining Experiences: Order, Customize, and Pay Seamlessly with I...
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
 
How to Break Your App with Playwright Tests
How to Break Your App with Playwright TestsHow to Break Your App with Playwright Tests
How to Break Your App with Playwright Tests
 

Intro to iOS Development • Made by Many

  • 2. In This Deck MVC Architecture Objective-C Syntax Classes Instances Methods Properties Setters + Getters Header + Implementation Delegates + Protocols Xcode IDE Key Classes + Terms In Objective-C This deck is shared with you under a Creative Commons license.
  • 3. Cloud Services User Input Model Coordinates between model and view Contains all application logic and data View Your application’s graphical user interface View Controller The MVC architecture is useful because it lets you abstract apart and organize your app into functional, replaceable modules. NSNotification MVC Architecture (Model + View + Controller)
  • 4. MVC Architecture (Model + View + Controller) Model View Result + = Tic Tac Toe Visual Tic Tac Toe Textual X played: (2, 3) O played: (3, 1) X played: (1, 3) SMS Textual Chris said: CoD? Adam said: nm, u? HJ said: sup same model • different view different model • same view
  • 5. Objective-C Syntax [[Vehicle alloc] initWithMake:@“Toyota” model:@“Prius” color:[UIColor blackColor]]; Objective-C is a verbose language. Method names and variable names tend to be very long. This is supposed to make it easier to understand your code and how to use methods.
  • 6. Objective-C Syntax Objective-C is an object-oriented language. Methods are really “messages” send to objects or classes telling them to do things. For example: [myCar setSpeed:50.0]; is really saying: “Tell myCar to set its speed to 50.0 mph.” 50.0 mph, please!
  • 7. Objective-C Syntax Xcode will attempt to autocomplete whatever you’re typing. This not only helps you save time (you can hit Tab to autocomplete) but also helps you discover relevant methods and properties.
  • 8. Objective-C Classes Vehicle myCar yourCar > make @“Toyota” @“Lamborghini” > model @“Prius” @“Aventador” > speed 50.0 95.0 Think of a class as a category, e.g., Vehicle. A class has no data but can perform some basic methods. A class also specifies what properties instances of that class should have. It’s kind of like a form that hasn’t been filled out. E.g., Vehicle might have properties for make, model, and speed.
  • 9. Objective-C Classes Vehicle Car Truck Motorcycle All classes in Objective-C inherit some methods and properties from a superclass. As a result, each class is a subclass of another class. E.g., Vehicle might be a subclass of NSObject and might have its own subclasses Car, Truck, and Motorcycle that have all the properties and methods of Vehicles but also add their own properties and methods.
  • 10. Objective-C Instances An instance is a specific instance of a class. E.g., myCar might be an instance of Car. An instance has data and may have some methods that you can perform on that data. E.g., For myCar, you would have the following values for your properties: myCar.make = @“Toyota”; myCar.model = @“Prius”; myCar.speed = 55.0; myCar.gas = 10.0; myCar.owner = @“Ken M. Haggerty”; Instances are often created using alloc and init, e.g.: [[Car alloc] init]; or using a “convenience” method, e.g.: [Car carWithOwner:@“Ken M. Haggerty”];
  • 11. Objective-C Methods A class method is a method that is performed on a class rather than a specific instance of a class. Class methods are often useful for instantiation and general methods not specific to instances. E.g., [NSArray arrayWithObject:firstObject] creates a new array with one object in it, or, [TicTacToe howManyInARowToWin] might return 3. An instance method is a method that is performed on an instance of a class. Instance methods are useful for changing or manipulating instances of your class. E.g., If myString is set to @“filename”, [myString stringbyAppendingString:@“.png”] would return the string @“filename.png”.
  • 12. Objective-C Properties Properties are how data are stored in instances of your class. They are like fields on a form. Each property defines what kind of data it should hold, but only instances of your class actually hold that data. E.g., Car might have the property @property (nonatomic) BOOL isNewCar; while myCar, an instance of Car, might have isNewCar set to NO.
  • 13. Objective-C Setters + Getters When you create a property, Objective-C will automatically create helper methods for accessing and setting values for your property. I.e., When you create: @property (nonatomic, strong) NSString *owner; Objective-C will create the following two instance methods for you: - (void)setOwner:(NSString *)owner; - (NSString *)owner; Both of these methods are accessible to you as soon as you define your property. However, you can always write your own custom implementation for your helper and/or getter.
  • 14. Objective-C Setters + Getters Setters are only called when that property is being set explicitly, e.g.: [myCar setOwner:@“Ken M. Haggerty”]; myCar.owner = @“Ken M. Haggerty”; Getters can be called in either of the following ways: [usa name]; usa.name; The second syntax in each of the above examples is called dot notation and is usually only used for properties in Objective-C.
  • 15. Objective-C Header + Implementation Files “Burger, please!” (returns burger) <YourClass>.h Dictates public interface for this class; i.e., how other classes can and should interact with this class. ● Imports (#import) ● Protocols (@protocol) ● Public API (@interface) <YourClass>.m Dictates private interface for this class + contains all method implementations for this class. ● Imports (#import) ● Private API (@interface) ● Implementation (@implementation) In Objective-C, the header (.h) file is “public” while the implementation file (.m) is “private.” The header file should be organized, clear, and state what the class does and how to use it.
  • 16. Objective-C Delegates + Protocols In well-written Objective-C, your model and your view are completely agnostic of each other. I.e., Your model should not be in any way dependent on how it is ultimately presented to the user, and your view should not care what kind of data it is representing. Instead, your model and view should communicate using the following relationships: ● Your view controller can change your model. ● Your model can change itself. ● Your model can send out notifications when it is changed. ● Your view controller can listen for notifications and act accordingly. ● Your view controller can change your view. To do this, we often used delegates to delegate methods and properties from view controllers to models. E.g., UITableViewController has two delegates: delegate and dataSource. When assigning delegates, we can ensure that our delegates implement the necessary properties and methods by specifying protocols that they should follow. We can dictate what protocols a property should follow when defining them. E.g.: @property (nonatomic, weak) id <MyProtocol> delegate;
  • 17. Xcode IDE (Integrated Development Environment) Demo There’s a lot going on in Xcode, so we’ll explore by clicking around. If you have trouble using Xcode or have any questions, don’t hesitate! Ken will be happy to help.
  • 18. Objective-C Key Classes + Terms NSObject or id: Top-level object in Objective-C. Almost all objects in Objective-C inherit from NSObject. UIViewController: A basic view controller in Objective-C. All view controllers inherit from UIViewController. UIView: A basic view in Objective-C. Views are always rectangles. All views inherit from UIView. Views can be placed as subviews within another view. UIButton: A basic button in Objective-C. Buttons can respond to touch events. UIImage: An image in Objective-C. UIImageView: A subclass of UIView designed for displaying an image. UIScrollView: A subclass of UIView designed for scrolling content. Scrollviews are tricky but incredibly useful. IBOutlet / IBAction: Designates that a property / method should be connected to a view via Interface Builder. nonatomic / atomic: You will always use nonatomic. This has to do with thread safety regarding setters and getters for properties. strong / weak: Determines whether a property’s value should be held even if no other object is pointing to that value. Strong = yes, weak = no. self: Used within an instance method to refer to the instance the method was sent to. Interface Builder / Storyboard: Visual interface within Xcode IDE for laying out and creating your app’s GUI. UITableViewController: A subclass of UIScrollView designed for presenting scrollable tables. UITableView: A subclass of UIScrollView designed for presenting scrollable tables. UITableViewCell: A subclass of UIView designed for presenting content in tables. UITableViewCells are reused as the table view is scrolled, increasing responsivity and smoothness. NSArray: A subclass of NSObject that contains an uneditable list of NSObjects. NSMutableArray: A subclass of NSArray where its list of NSObjects are editable. NSString: A subclass of NSObject for text. BOOL: A binary type that’s actually just plain C. Can have value YES or NO. int: A C class for storing integer values. float: A C class for storing floats (i.s., decimal values). #import: Add a library, framework, or another class to the current class. Apple has very thorough documentation available from within Xcode at Help > Documentation and API Reference and online at https://developer.apple.com/library/ios/navigation/