SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
I N T RO TO S W I F T
C O D E & S U P P LY
M E
I N T R O T O S W I F T
Justin Reese
- Code & Supply
- Polyglot
- iOS baptism by fire
- 6 apps. Mostly web views
A G E N D A
I N T R O T O S W I F T
I tell you some C&S stuff
I tell you some Swift stuff
We discuss as a group - or -
We break off into small groups
W H AT ’ S S W I F T
I N T R O T O S W I F T
Apple’s new language
- Systems programming
- Expressive
- REPL
- Cocoa/Cocoa Touch backed
H O W D O I S W I F T ?
I N T R O T O S W I F T
Xcode 6 Beta
- Now free!!
- “The Swift Programming Language”
F O L L O W A L O N G
I N T R O T O S W I F T
F O L L O W A L O N G
I N T R O T O S W I F T
l l d b - - r e p l
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
B A S I C S
I N T R O T O S W I F T
# i m p o r t < s t d i o . h >
# i m p o r t < F o u n d a t i o n / F o u n d a t i o n . h >
i n t m a i n ( v o i d )
{
N S S t r i n g * g r e e t i n g = @ " H e l l o " ;
N S S t r i n g * n a m e = @ " J u s t i n " ;
N S S t r i n g * o u t p u t = [ N S S t r i n g s t r i n g W i t h F o r m a t : @ " % @ % @ " , g r e e t i n g , n a m e ] ;
N S L o g ( o u t p u t ) ;
r e t u r n 0 ;
}
B A S I C S
I N T R O T O S W I F T
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g ? = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g ? = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
B A S I C S
I N T R O T O S W I F T
l e t g r e e t i n g = “ H e l l o ”
v a r n a m e : S t r i n g ? = “ J u s t i n ”
p r i n t l n ( g r e e t i n g + “ ” + n a m e )
I N T E R P O L AT I O N
I N T R O T O S W I F T
l e t a = 3 , b = 5
p r i n t l n ( “  ( a ) t i m e s  ( b ) i s  ( a * b ) ” )
C O N S TA N T S
I N T R O T O S W I F T
l e t a = 3 , b = 5
a = 5 / / C o m p i l e e r r o r
p r i n t l n ( “  ( a ) t i m e s  ( b ) i s  ( a * b ) ” )
C O L L E C T I O N S
I N T R O T O S W I F T
v a r p e o p l e = [ “ J u s t i n ” , “ R o m e o ” ]
/ / A u t o m a t i c a l l y t y p e d
p e o p l e + = “ B e n ”
v a r d i c t i o n a r y [ “ k e y ” : “ v a l u e ” ]
v a r p e o p l e : S t r i n g [ ] = [ “ J u s t i n ” , “ R o m e o ” ]
/ / E x p l i c i t l y t y p e d
p e o p l e + = 2 / / E r r o r
C O N T R O L
I N T R O T O S W I F T
f o r n a m e i n n a m e s {
p r i n t l n ( “ H e l l o ” + n a m e )
}
f o r ( k e y , v a l u e ) i n d i c t i o n a r y {
p r i n t l n ( k e y + “ i s ” + v a l u e )
}
C O N T R O L
I N T R O T O S W I F T
i f a t t e n d e e C o u n t > 1 0 {
p r i n t l n ( “ c o o l ” )
} e l s e i f a t t e n d e e C o u n t = = 0 {
p r i n t l n ( “ W T F ” )
} e l s e
p r i n t l n ( “ m e h ” )
}
C O N T R O L
I N T R O T O S W I F T
s w i t c h a t t e n d e e C o u n t {
c a s e > 1 0 :
p r i n t l n ( “ c o o l ” )
c a s e 0 :
p r i n t l n ( “ W T F ” )
d e f a u l t :
p r i n t l n ( “ m e h ” )
}
F U N C T I O N S
I N T R O T O S W I F T
f u n c s a y H i ( w h o : S t r i n g = “ W o r l d ” ) {
l e t g r e e t i n g = “ H e l l o ”
p r i n t l n ( g r e e t i n g + “ ” + w h o )
}
s a y H i ( “ C o l i n ” )
F U N C T I O N S
I N T R O T O S W I F T
f u n c s a y H i ( w h o : S t r i n g = “ W o r l d ” ) - > S t r i n g {
l e t g r e e t i n g = “ H e l l o ”
r e t u r n g r e e t i n g + “ ” + w h o
}
p r i n t l n ( s a y H i ( “ C o l i n ” ) )
C L O S U R E S
I N T R O T O S W I F T
l e t g r e e t i n g = {
r e t u r n “ H e l l o ” + “ W o r l d ”
}
p r i n t l n ( g r e e t i n g ( ) )
C L A S S E S
I N T R O T O S W I F T
c l a s s P e r s o n {
v a r h o b b i e s = [ “ s o c i a l i z i n g ” ]
}
c l a s s P r o g r a m m e r : P e r s o n {
i n i t ( ) {
s u p e r . i n i t ( )
h o b b i e s = [ “ s t a r i n g a t b l a c k s c r e e n s ” ]
}
}
l e t j u s t i n = P r o g r a m m e r ( )
f o r h o b b y i n j u s t i n . h o b b i e s {
p r i n t l n ( h o b b y )
}
P R O P E R T Y O B S E R V E R S
I N T R O T O S W I F T
c l a s s P e r s o n {
v a r h o b b i e s : A r r a y {
w i l l S e t {
p r i n t l n ( “ A d d i n g  ( n e w V a l u e ) , e h ? ” )
}
d i d S e t {
f o r o l d H o b b y i n o l d V a l u e {
p r i n t l n ( “ r e m o v e  ( o l d H o b b y ) ? ” )
}
}
}
}
@justinxreese

Mais conteúdo relacionado

Mais procurados

Construccion formal
Construccion formalConstruccion formal
Construccion formalCarolina G
 
Aporte isaura salazar paso 3
Aporte isaura salazar paso 3Aporte isaura salazar paso 3
Aporte isaura salazar paso 3Jose Labio
 
Catálogo de Montagem Capota Marítima Corsa
Catálogo de Montagem Capota Marítima CorsaCatálogo de Montagem Capota Marítima Corsa
Catálogo de Montagem Capota Marítima Corsaantonio sérgio nogueira
 
Kozterem prezentacio 03_02
Kozterem prezentacio 03_02Kozterem prezentacio 03_02
Kozterem prezentacio 03_02matelencse
 
Informe do interventor municipal sobre o PXOM de Nigrán 2013
Informe do interventor municipal sobre o PXOM de Nigrán 2013Informe do interventor municipal sobre o PXOM de Nigrán 2013
Informe do interventor municipal sobre o PXOM de Nigrán 2013Valminor.info
 
3 Must-Use Tools When Writing Content and Copy
3 Must-Use Tools When Writing Content and Copy3 Must-Use Tools When Writing Content and Copy
3 Must-Use Tools When Writing Content and CopyJessica Walrack
 
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233Janie Coffey
 
La Palestra del Networking
La Palestra del NetworkingLa Palestra del Networking
La Palestra del NetworkingGiuseppe Citerna
 
In Adaptation - Italo Calvino's Invisible Cities: Bukit Bintang
In Adaptation - Italo Calvino's Invisible Cities: Bukit BintangIn Adaptation - Italo Calvino's Invisible Cities: Bukit Bintang
In Adaptation - Italo Calvino's Invisible Cities: Bukit BintangJoe Onn Lim
 
Desenvolvimento de robô social
Desenvolvimento de robô socialDesenvolvimento de robô social
Desenvolvimento de robô socialFernando Passold
 
Presentacion de visual basic
Presentacion de visual basicPresentacion de visual basic
Presentacion de visual basicKaren-rivera
 
Apps for Good 2014 Presentation
Apps for Good 2014 PresentationApps for Good 2014 Presentation
Apps for Good 2014 PresentationSadiyah07
 
Mapa Conceptual - Revista Rolling Stone
Mapa Conceptual - Revista Rolling StoneMapa Conceptual - Revista Rolling Stone
Mapa Conceptual - Revista Rolling Stonesmariateresa
 
Energy Future (Top predictions)
Energy Future (Top predictions)Energy Future (Top predictions)
Energy Future (Top predictions)Minka Grdesic
 
Historia del linux
Historia del linuxHistoria del linux
Historia del linuxChris Abarca
 

Mais procurados (20)

Construccion formal
Construccion formalConstruccion formal
Construccion formal
 
Aporte isaura salazar paso 3
Aporte isaura salazar paso 3Aporte isaura salazar paso 3
Aporte isaura salazar paso 3
 
Catálogo de Montagem Capota Marítima Corsa
Catálogo de Montagem Capota Marítima CorsaCatálogo de Montagem Capota Marítima Corsa
Catálogo de Montagem Capota Marítima Corsa
 
Kozterem prezentacio 03_02
Kozterem prezentacio 03_02Kozterem prezentacio 03_02
Kozterem prezentacio 03_02
 
Informe do interventor municipal sobre o PXOM de Nigrán 2013
Informe do interventor municipal sobre o PXOM de Nigrán 2013Informe do interventor municipal sobre o PXOM de Nigrán 2013
Informe do interventor municipal sobre o PXOM de Nigrán 2013
 
3 Must-Use Tools When Writing Content and Copy
3 Must-Use Tools When Writing Content and Copy3 Must-Use Tools When Writing Content and Copy
3 Must-Use Tools When Writing Content and Copy
 
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233
Luxury Home for Sale | 2297 Oceanside Ct Atlantic Beach, FL 32233
 
La Palestra del Networking
La Palestra del NetworkingLa Palestra del Networking
La Palestra del Networking
 
In Adaptation - Italo Calvino's Invisible Cities: Bukit Bintang
In Adaptation - Italo Calvino's Invisible Cities: Bukit BintangIn Adaptation - Italo Calvino's Invisible Cities: Bukit Bintang
In Adaptation - Italo Calvino's Invisible Cities: Bukit Bintang
 
Jukedeck
JukedeckJukedeck
Jukedeck
 
Psicología
PsicologíaPsicología
Psicología
 
Desenvolvimento de robô social
Desenvolvimento de robô socialDesenvolvimento de robô social
Desenvolvimento de robô social
 
Presentacion de visual basic
Presentacion de visual basicPresentacion de visual basic
Presentacion de visual basic
 
Apps for Good 2014 Presentation
Apps for Good 2014 PresentationApps for Good 2014 Presentation
Apps for Good 2014 Presentation
 
Caça palavras Era Napoleônica
Caça palavras Era NapoleônicaCaça palavras Era Napoleônica
Caça palavras Era Napoleônica
 
Mapa Conceptual - Revista Rolling Stone
Mapa Conceptual - Revista Rolling StoneMapa Conceptual - Revista Rolling Stone
Mapa Conceptual - Revista Rolling Stone
 
Energy Future (Top predictions)
Energy Future (Top predictions)Energy Future (Top predictions)
Energy Future (Top predictions)
 
443 Presentation final
443 Presentation final443 Presentation final
443 Presentation final
 
Historia del linux
Historia del linuxHistoria del linux
Historia del linux
 
Chomko LA 9
Chomko LA 9Chomko LA 9
Chomko LA 9
 

Semelhante a Intro to Swift

MS2 CONSOLIDACION CALCULOS.pptx
MS2  CONSOLIDACION CALCULOS.pptxMS2  CONSOLIDACION CALCULOS.pptx
MS2 CONSOLIDACION CALCULOS.pptxjuan650989
 
Academia GolfRange Campinas
Academia GolfRange CampinasAcademia GolfRange Campinas
Academia GolfRange CampinasLucie Hájková
 
Portafolio Francisco Díaz Tazza
Portafolio Francisco Díaz TazzaPortafolio Francisco Díaz Tazza
Portafolio Francisco Díaz TazzaFranciscoDiazTazza
 
Collants et bas : Sélection des tendances 2017-18
Collants et bas : Sélection des tendances 2017-18Collants et bas : Sélection des tendances 2017-18
Collants et bas : Sélection des tendances 2017-18Sous-Vêtements Júlia
 
Why your brand needs digital signage games
Why your brand needs digital signage gamesWhy your brand needs digital signage games
Why your brand needs digital signage gamesBen Chong
 
Silabo Diseño de Plantas y Equip
Silabo Diseño de Plantas y EquipSilabo Diseño de Plantas y Equip
Silabo Diseño de Plantas y Equipandreaca85
 
Aplicaciones de la integral definida 1
Aplicaciones de la integral definida 1Aplicaciones de la integral definida 1
Aplicaciones de la integral definida 1jaidalijouliefonseca
 
Aplicacion de la integral definida matematica 1
Aplicacion de la integral definida matematica 1Aplicacion de la integral definida matematica 1
Aplicacion de la integral definida matematica 1jaidalijouliefonseca
 
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma  pgf-r-04 2013 ii semestre definitivo en pdfCronograma  pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma pgf-r-04 2013 ii semestre definitivo en pdfAnamaria Pinto
 
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma  pgf-r-04 2013 ii semestre definitivo en pdfCronograma  pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma pgf-r-04 2013 ii semestre definitivo en pdfAnamaria Pinto
 
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALAR
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALARJARDIM TERAPÊUTICO - ARQUITETURA HOSPITALAR
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALARanaluisamesquita18
 
IndustrialDesign_introspect1
IndustrialDesign_introspect1IndustrialDesign_introspect1
IndustrialDesign_introspect1Phehello Mosoang
 
L'art del renaixement, característiques.pdf
L'art del renaixement, característiques.pdfL'art del renaixement, característiques.pdf
L'art del renaixement, característiques.pdfselidris
 

Semelhante a Intro to Swift (20)

MS2 CONSOLIDACION CALCULOS.pptx
MS2  CONSOLIDACION CALCULOS.pptxMS2  CONSOLIDACION CALCULOS.pptx
MS2 CONSOLIDACION CALCULOS.pptx
 
Academia GolfRange Campinas
Academia GolfRange CampinasAcademia GolfRange Campinas
Academia GolfRange Campinas
 
Portafolio Francisco Díaz Tazza
Portafolio Francisco Díaz TazzaPortafolio Francisco Díaz Tazza
Portafolio Francisco Díaz Tazza
 
Poesia Recife
Poesia RecifePoesia Recife
Poesia Recife
 
Ensayo directo
Ensayo directoEnsayo directo
Ensayo directo
 
Cortedirecto
CortedirectoCortedirecto
Cortedirecto
 
Collants et bas : Sélection des tendances 2017-18
Collants et bas : Sélection des tendances 2017-18Collants et bas : Sélection des tendances 2017-18
Collants et bas : Sélection des tendances 2017-18
 
Why your brand needs digital signage games
Why your brand needs digital signage gamesWhy your brand needs digital signage games
Why your brand needs digital signage games
 
Silabo Diseño de Plantas y Equip
Silabo Diseño de Plantas y EquipSilabo Diseño de Plantas y Equip
Silabo Diseño de Plantas y Equip
 
Aplicaciones de la integral definida 1
Aplicaciones de la integral definida 1Aplicaciones de la integral definida 1
Aplicaciones de la integral definida 1
 
Aplicacion de la integral definida matematica 1
Aplicacion de la integral definida matematica 1Aplicacion de la integral definida matematica 1
Aplicacion de la integral definida matematica 1
 
tucanes (2).pdf
tucanes (2).pdftucanes (2).pdf
tucanes (2).pdf
 
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma  pgf-r-04 2013 ii semestre definitivo en pdfCronograma  pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
 
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma  pgf-r-04 2013 ii semestre definitivo en pdfCronograma  pgf-r-04 2013 ii semestre definitivo en pdf
Cronograma pgf-r-04 2013 ii semestre definitivo en pdf
 
SEO for Apps
SEO for AppsSEO for Apps
SEO for Apps
 
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALAR
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALARJARDIM TERAPÊUTICO - ARQUITETURA HOSPITALAR
JARDIM TERAPÊUTICO - ARQUITETURA HOSPITALAR
 
IndustrialDesign_introspect1
IndustrialDesign_introspect1IndustrialDesign_introspect1
IndustrialDesign_introspect1
 
L'art del renaixement, característiques.pdf
L'art del renaixement, característiques.pdfL'art del renaixement, característiques.pdf
L'art del renaixement, característiques.pdf
 
Acta directivos 2015
Acta directivos 2015Acta directivos 2015
Acta directivos 2015
 
Granulometria
GranulometriaGranulometria
Granulometria
 

Intro to Swift

  • 1. I N T RO TO S W I F T C O D E & S U P P LY
  • 2. M E I N T R O T O S W I F T Justin Reese - Code & Supply - Polyglot - iOS baptism by fire - 6 apps. Mostly web views
  • 3. A G E N D A I N T R O T O S W I F T I tell you some C&S stuff I tell you some Swift stuff We discuss as a group - or - We break off into small groups
  • 4. W H AT ’ S S W I F T I N T R O T O S W I F T Apple’s new language - Systems programming - Expressive - REPL - Cocoa/Cocoa Touch backed
  • 5. H O W D O I S W I F T ? I N T R O T O S W I F T Xcode 6 Beta - Now free!! - “The Swift Programming Language”
  • 6. F O L L O W A L O N G I N T R O T O S W I F T
  • 7. F O L L O W A L O N G I N T R O T O S W I F T l l d b - - r e p l
  • 8. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 9. B A S I C S I N T R O T O S W I F T # i m p o r t < s t d i o . h > # i m p o r t < F o u n d a t i o n / F o u n d a t i o n . h > i n t m a i n ( v o i d ) { N S S t r i n g * g r e e t i n g = @ " H e l l o " ; N S S t r i n g * n a m e = @ " J u s t i n " ; N S S t r i n g * o u t p u t = [ N S S t r i n g s t r i n g W i t h F o r m a t : @ " % @ % @ " , g r e e t i n g , n a m e ] ; N S L o g ( o u t p u t ) ; r e t u r n 0 ; }
  • 10. B A S I C S I N T R O T O S W I F T
  • 11. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 12. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 13. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g ? = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 14. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g ? = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 15. B A S I C S I N T R O T O S W I F T l e t g r e e t i n g = “ H e l l o ” v a r n a m e : S t r i n g ? = “ J u s t i n ” p r i n t l n ( g r e e t i n g + “ ” + n a m e )
  • 16. I N T E R P O L AT I O N I N T R O T O S W I F T l e t a = 3 , b = 5 p r i n t l n ( “ ( a ) t i m e s ( b ) i s ( a * b ) ” )
  • 17. C O N S TA N T S I N T R O T O S W I F T l e t a = 3 , b = 5 a = 5 / / C o m p i l e e r r o r p r i n t l n ( “ ( a ) t i m e s ( b ) i s ( a * b ) ” )
  • 18. C O L L E C T I O N S I N T R O T O S W I F T v a r p e o p l e = [ “ J u s t i n ” , “ R o m e o ” ] / / A u t o m a t i c a l l y t y p e d p e o p l e + = “ B e n ” v a r d i c t i o n a r y [ “ k e y ” : “ v a l u e ” ] v a r p e o p l e : S t r i n g [ ] = [ “ J u s t i n ” , “ R o m e o ” ] / / E x p l i c i t l y t y p e d p e o p l e + = 2 / / E r r o r
  • 19. C O N T R O L I N T R O T O S W I F T f o r n a m e i n n a m e s { p r i n t l n ( “ H e l l o ” + n a m e ) } f o r ( k e y , v a l u e ) i n d i c t i o n a r y { p r i n t l n ( k e y + “ i s ” + v a l u e ) }
  • 20. C O N T R O L I N T R O T O S W I F T i f a t t e n d e e C o u n t > 1 0 { p r i n t l n ( “ c o o l ” ) } e l s e i f a t t e n d e e C o u n t = = 0 { p r i n t l n ( “ W T F ” ) } e l s e p r i n t l n ( “ m e h ” ) }
  • 21. C O N T R O L I N T R O T O S W I F T s w i t c h a t t e n d e e C o u n t { c a s e > 1 0 : p r i n t l n ( “ c o o l ” ) c a s e 0 : p r i n t l n ( “ W T F ” ) d e f a u l t : p r i n t l n ( “ m e h ” ) }
  • 22. F U N C T I O N S I N T R O T O S W I F T f u n c s a y H i ( w h o : S t r i n g = “ W o r l d ” ) { l e t g r e e t i n g = “ H e l l o ” p r i n t l n ( g r e e t i n g + “ ” + w h o ) } s a y H i ( “ C o l i n ” )
  • 23. F U N C T I O N S I N T R O T O S W I F T f u n c s a y H i ( w h o : S t r i n g = “ W o r l d ” ) - > S t r i n g { l e t g r e e t i n g = “ H e l l o ” r e t u r n g r e e t i n g + “ ” + w h o } p r i n t l n ( s a y H i ( “ C o l i n ” ) )
  • 24. C L O S U R E S I N T R O T O S W I F T l e t g r e e t i n g = { r e t u r n “ H e l l o ” + “ W o r l d ” } p r i n t l n ( g r e e t i n g ( ) )
  • 25. C L A S S E S I N T R O T O S W I F T c l a s s P e r s o n { v a r h o b b i e s = [ “ s o c i a l i z i n g ” ] } c l a s s P r o g r a m m e r : P e r s o n { i n i t ( ) { s u p e r . i n i t ( ) h o b b i e s = [ “ s t a r i n g a t b l a c k s c r e e n s ” ] } } l e t j u s t i n = P r o g r a m m e r ( ) f o r h o b b y i n j u s t i n . h o b b i e s { p r i n t l n ( h o b b y ) }
  • 26. P R O P E R T Y O B S E R V E R S I N T R O T O S W I F T c l a s s P e r s o n { v a r h o b b i e s : A r r a y { w i l l S e t { p r i n t l n ( “ A d d i n g ( n e w V a l u e ) , e h ? ” ) } d i d S e t { f o r o l d H o b b y i n o l d V a l u e { p r i n t l n ( “ r e m o v e ( o l d H o b b y ) ? ” ) } } } }