SlideShare a Scribd company logo
Swift Language
June.29th
Jun
History and Array
Brief History
iPhone 6
1972 1983 2010
2014
2007
2022
iPhone 14
iPhone
Begin
?
Swift
Fast, Safe, Powerful
Modern, Easy to learn
Array
Design Goal
1.Performance equivalent to C arrays for subscript get/set of non-
class element types is the most important performance goal.
2.It should be possible to receive an NSArray from Cocoa,
represent it as an Array<AnyObject>, and pass it right back to
Cocoa as an NSArray in O(1) and with no memory allocations.
3.Arrays should be usable as stacks, so we want amortized O(1)
append and O(1) popBack. Together with goal #1, this implies
a std::vector-like layout, with a reserved tail memory capacity
that can exceed the number of actual stored elements.
Class to Struct
WHAT IS COCOA?
Cocoa is an application environment for both the OS X
operating system and iOS, the operating system used on
Multi-Touch devices such as iPhone, iPad, and iPod
touch. It consists of a suite of object-oriented software
libraries, a runtime system, and an integrated
development environment.
COCOA FRAMEWORK
COCOA TOUCH VS COCOA
MAC iPhone
Foundation
Framework
Performance
Swift provides
three generic array types
ContiguousArray<Element>
Array<Element>
ArraySlice<Element>
ContiguousArray<Element>
ContiguousArray<Element> is the fastest and simplest of the three--use this when you need "C array" performance. The
elements of a ContiguousArray are always stored contiguously in memory.
__ContiguousArrayStorageBase supplies
the implementation of the _NSArrayCore
API (and thus, NSArray the API) for our
_ContiguousArrayStorage<T>.
We can't put this implementation directly
on _ContiguousArrayStorage because
generic classes can't override Objective-C
selectors.
ContiguousArray
Buffer ContiguousArrayBuffer
Storage ContiguousArrayStorageBase
SwiftNativeNSArrayWithContiguousStorage
SwiftNativeNSArray
=
=
Struct
Class
Array Append
Append
Returns `true` and puts the bu
ff
er in a mutable state
if the bu
ff
er's storage is uniquely-referenced;
otherwise, performs no action and returns `false`.
- Precondition: The bu
ff
er must be immutable.
- Warning: It's a requirement to call `beginCOWMutation` before the bu
ff
er is
mutated.
Permission
Space?
The number of elements of buffer
The number of elements of buffer is longer than capacity
Over
fl
ow addition (&+)
The number of elements of buffer
The number of elements of buffer is longer than capacity
Optimization
Copy On Write
Struct Struct
Copy
Copy On Write
Struct
Struct
Struct
Struct
Struct
Struct Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
…
Copy On Write
Struct
Struct
Struct
Struct
Struct
Struct Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
Struct
First Index
Append
Append
Array Remove
To be Remove(pointer)
Source( pointer + 1)
Thanks
REF
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CocoaFundamentals/WhatIsCocoa/WhatIsCocoa.html
https://www.swift.org/documentation/

More Related Content

Similar to Swfit_Array_GDG.pdf

Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedGaurav Maheshwari
 
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
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPsJames Ward
 
React native
React nativeReact native
JVM Language Summit: Object layout presentation
JVM Language Summit: Object layout presentationJVM Language Summit: Object layout presentation
JVM Language Summit: Object layout presentation
Azul Systems, Inc.
 
Java mcq
Java mcqJava mcq
Java mcq
avinash9821
 
Java7
Java7Java7
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
vmadan89
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
Nanthini Kempaiyan
 
spread operator vs array.concat()
spread operator vs array.concat()spread operator vs array.concat()
spread operator vs array.concat()
曾 子芸
 
JVM Language Summit: Object layout workshop
JVM Language Summit: Object layout workshopJVM Language Summit: Object layout workshop
JVM Language Summit: Object layout workshop
Azul Systems, Inc.
 
five Sling features you should know
five Sling features you should knowfive Sling features you should know
five Sling features you should know
connectwebex
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
Tunvir Rahman Tusher
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworks
MD Sayem Ahmed
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
Diksha Bhargava
 
ES6 - JavaCro 2016
ES6 - JavaCro 2016ES6 - JavaCro 2016
ES6 - JavaCro 2016
Nenad Pecanac
 

Similar to Swfit_Array_GDG.pdf (20)

Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 
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)
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
 
React native
React nativeReact native
React native
 
JVM Language Summit: Object layout presentation
JVM Language Summit: Object layout presentationJVM Language Summit: Object layout presentation
JVM Language Summit: Object layout presentation
 
Java mcq
Java mcqJava mcq
Java mcq
 
Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
 
Java7
Java7Java7
Java7
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
Introduction java programming
Introduction java programmingIntroduction java programming
Introduction java programming
 
spread operator vs array.concat()
spread operator vs array.concat()spread operator vs array.concat()
spread operator vs array.concat()
 
JVM Language Summit: Object layout workshop
JVM Language Summit: Object layout workshopJVM Language Summit: Object layout workshop
JVM Language Summit: Object layout workshop
 
five Sling features you should know
five Sling features you should knowfive Sling features you should know
five Sling features you should know
 
iOS Application Development
iOS Application DevelopmentiOS Application Development
iOS Application Development
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
A brief overview of java frameworks
A brief overview of java frameworksA brief overview of java frameworks
A brief overview of java frameworks
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
 
ES6 - JavaCro 2016
ES6 - JavaCro 2016ES6 - JavaCro 2016
ES6 - JavaCro 2016
 

More from JUNSHIN8

AlamofirebyJun.pdf
AlamofirebyJun.pdfAlamofirebyJun.pdf
AlamofirebyJun.pdf
JUNSHIN8
 
Hapit_mid_HyunjunShin.pptx
 Hapit_mid_HyunjunShin.pptx Hapit_mid_HyunjunShin.pptx
Hapit_mid_HyunjunShin.pptx
JUNSHIN8
 
[Apple_Korea] Green World
[Apple_Korea] Green World[Apple_Korea] Green World
[Apple_Korea] Green World
JUNSHIN8
 
CoreData.pptx
CoreData.pptxCoreData.pptx
CoreData.pptx
JUNSHIN8
 
Computer_Architecture.pptx
Computer_Architecture.pptxComputer_Architecture.pptx
Computer_Architecture.pptx
JUNSHIN8
 
Notification_Center.pptx
Notification_Center.pptxNotification_Center.pptx
Notification_Center.pptx
JUNSHIN8
 
Fundamental Design Patterns.pptx
Fundamental Design Patterns.pptxFundamental Design Patterns.pptx
Fundamental Design Patterns.pptx
JUNSHIN8
 
GithubWithTerminal.pptx
GithubWithTerminal.pptxGithubWithTerminal.pptx
GithubWithTerminal.pptx
JUNSHIN8
 
Algorithm Introduction.pptx
Algorithm Introduction.pptxAlgorithm Introduction.pptx
Algorithm Introduction.pptx
JUNSHIN8
 

More from JUNSHIN8 (9)

AlamofirebyJun.pdf
AlamofirebyJun.pdfAlamofirebyJun.pdf
AlamofirebyJun.pdf
 
Hapit_mid_HyunjunShin.pptx
 Hapit_mid_HyunjunShin.pptx Hapit_mid_HyunjunShin.pptx
Hapit_mid_HyunjunShin.pptx
 
[Apple_Korea] Green World
[Apple_Korea] Green World[Apple_Korea] Green World
[Apple_Korea] Green World
 
CoreData.pptx
CoreData.pptxCoreData.pptx
CoreData.pptx
 
Computer_Architecture.pptx
Computer_Architecture.pptxComputer_Architecture.pptx
Computer_Architecture.pptx
 
Notification_Center.pptx
Notification_Center.pptxNotification_Center.pptx
Notification_Center.pptx
 
Fundamental Design Patterns.pptx
Fundamental Design Patterns.pptxFundamental Design Patterns.pptx
Fundamental Design Patterns.pptx
 
GithubWithTerminal.pptx
GithubWithTerminal.pptxGithubWithTerminal.pptx
GithubWithTerminal.pptx
 
Algorithm Introduction.pptx
Algorithm Introduction.pptxAlgorithm Introduction.pptx
Algorithm Introduction.pptx
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 

Swfit_Array_GDG.pdf