SlideShare uma empresa Scribd logo
1 de 80
Applicazione iPhone con
utilizzo di UIKit e CoreData


Giannandrea Castaldi
Software Engineer in Exmachina.ch
giannandrea.castaldi@exmachina.ch
http://www.exmachina.ch
Obiettivo
Obiettivo


Design e pratiche utilizzate nello sviluppo di
            applicazioni iPhone
Obiettivo


 Design e pratiche utilizzate nello sviluppo di
             applicazioni iPhone

Come utilizzare UIKit quasi esclusivamente da
                   codice
Obiettivo


  Design e pratiche utilizzate nello sviluppo di
              applicazioni iPhone

 Come utilizzare UIKit quasi esclusivamente da
                    codice

Come definire il persistent stack di CoreData da
                    codice
Studio
Studio
Studio
Studio
XCode: IDE di sviluppo
XCode: IDE di sviluppo




                         k!
                         O
IB: Graphical editor per GUI
IB: Graphical editor per GUI




                             n h
                           io it
                         ut t w
                       ca bu
                        k,
                      O
Interface Builder
Interface Builder

     No RAD (Rapid Application
          Development)
Interface Builder

     No RAD (Rapid Application
          Development)

  No RGD (Rapid Gui Development)
Interface Builder

     No RAD (Rapid Application
          Development)

  No RGD (Rapid Gui Development)

     Alla lunga paga di più fare
    direttamente tutto da codice
Interface Builder

   Jonathan Zdziarski: “Many of the
  properties you’re able to set using IB
  are reproducible in code. Think of IB
  as a GUI for code. While IB supports
  many of the same characteristics you
      can set up, it not support all”.
CoreData model: Editor Grafico
CoreData model: Editor Grafico




                          an ,
                            ks
                        Th No
CoreData model: da codice
CoreData model: da codice




                        k!
                       O
CoreData

  Core Data Programming Guide by
     Apple: “You typically create the
   managed object model graphically
 using Xcode's Data Model Design tool.
    (If you wish you can construct the
 model programmatically at runtime.)”.
i4twitties




       [Demo e Project overview]
UIKit
UIKit

UIKit fornisce gli oggetti necessari per:
UIKit

UIKit fornisce gli oggetti necessari per:
•eseguire applicazioni grafiche
UIKit

UIKit fornisce gli oggetti necessari per:
•eseguire applicazioni grafiche
•MVC: visualizzare i contenuti sul video
UIKit

UIKit fornisce gli oggetti necessari per:
•eseguire applicazioni grafiche
•MVC: visualizzare i contenuti sul video
•MVC: gestire le azioni dell’utente
UIKit: UIWindow




      [esempio MainWindow]
UIKit: UIView




 [esempio UserCatalogViewController]
UIKit: UIViewController
UIKit: UIViewController

Due responsabilità:
UIKit: UIViewController

Due responsabilità:
•visualizzare il modello sulla vista
UIKit: UIViewController

Due responsabilità:
•visualizzare il modello sulla vista
•far evolvere il modello sulla base delle
 azioni dell’utente
UIKit: UIViewController

Due responsabilità:
•visualizzare il modello sulla vista
•far evolvere il modello sulla base delle
 azioni dell’utente

   [esempio TimeLineViewController con
          utilizzo di UITableView]
UIKit: UINavigationController




       [esempio MainWindow]
CoreData

Offre la gestione del ciclo di vita di oggetti
                 persistenti.

La persistenza può essere su file Sqlite, xml
                  e binari.
CoreData: NSManagedObject


                             User


                                homeTimeline


                           TimeLine

                timeLine            loadedStatus

                                         Status
                Status 1                   n
CoreData: NSManagedObject


                                   User
Oggetti del modello
   persistenti                        homeTimeline


                                 TimeLine

                      timeLine            loadedStatus

                                               Status
                      Status 1                   n
CoreData: NSManagedObject


                                   User
Oggetti del modello
   persistenti                        homeTimeline


                                 TimeLine

Insieme formano un    timeLine            loadedStatus

  grafo di entità e   Status 1
                                               Status
                                                 n
      relazioni
NSManagedObjectContext



                       Context                        Context
                            User                           User


                               homeTimeline                   homeTimeline

                           TimeLine                       TimeLine

                timeLine       loadedStatus    timeLine       loadedStatus

                  Status              Status     Status              Status
                    1                   n          1                   n
NSManagedObjectContext


Legge/scrive/rimuove          Context                        Context
   gli oggetti dalla               User                           User



     persistenza                      homeTimeline                   homeTimeline

                                  TimeLine                       TimeLine

                       timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status
                           1                   n          1                   n
NSManagedObjectContext


Legge/scrive/rimuove             Context                        Context
   gli oggetti dalla                  User                           User



     persistenza                         homeTimeline                   homeTimeline

                                     TimeLine                       TimeLine

                          timeLine       loadedStatus    timeLine       loadedStatus

  Con un context si         Status
                              1
                                                Status
                                                  n
                                                           Status
                                                             1
                                                                               Status
                                                                                 n


agisce su sezioni degli
  oggetti persistenti
NSPersistentStoreCoordinator
                          Context                        Context
                               User                           User


                                  homeTimeline                   homeTimeline

                              TimeLine                       TimeLine

                   timeLine       loadedStatus    timeLine       loadedStatus

                     Status              Status     Status              Status
                       1                   n          1                   n




                                         Coordinator
NSPersistentStoreCoordinator
                                  Context                        Context

Presenta al context gli                User


                                          homeTimeline
                                                                      User


                                                                         homeTimeline

object store sottostanti              TimeLine                       TimeLine


 come un’unico store       timeLine

                             Status
                                          loadedStatus

                                                 Status
                                                          timeLine

                                                            Status
                                                                         loadedStatus

                                                                                Status
                               1                   n          1                   n




                                                 Coordinator
NSPersistentStoreCoordinator
                                  Context                        Context

Presenta al context gli                User


                                          homeTimeline
                                                                      User


                                                                         homeTimeline

object store sottostanti              TimeLine                       TimeLine


 come un’unico store       timeLine

                             Status
                                          loadedStatus

                                                 Status
                                                          timeLine

                                                            Status
                                                                         loadedStatus

                                                                                Status
                               1                   n          1                   n



Un context può creare
 un grafo di oggetti
distribuiti su più data                          Coordinator


        store.
Data Store
                    Context                        Context
                         User                           User


                            homeTimeline                   homeTimeline

                        TimeLine                       TimeLine

             timeLine       loadedStatus    timeLine       loadedStatus

               Status              Status     Status              Status
                 1                   n          1                   n




                                   Coordinator
Data Store
                              Context                        Context
                                   User                           User


                                      homeTimeline                   homeTimeline

 Mappa gli oggetti                TimeLine                       TimeLine



 persistenti nel file   timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status


     associato
                           1                   n          1                   n




                                             Coordinator
Data Store
                              Context                        Context
                                   User                           User


                                      homeTimeline                   homeTimeline

 Mappa gli oggetti                TimeLine                       TimeLine



 persistenti nel file   timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status


     associato
                           1                   n          1                   n




                                             Coordinator


                        Data
                        Store

                       Sqlite
Data Store
                              Context                        Context
                                   User                           User


                                      homeTimeline                   homeTimeline

 Mappa gli oggetti                TimeLine                       TimeLine



 persistenti nel file   timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status


     associato
                           1                   n          1                   n




                                             Coordinator


                        Data              Data
                        Store             Store

                       Sqlite             Sqlite
Data Store
                              Context                        Context
                                   User                           User


                                      homeTimeline                   homeTimeline

 Mappa gli oggetti                TimeLine                       TimeLine



 persistenti nel file   timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status


     associato
                           1                   n          1                   n




                                             Coordinator


                        Data              Data         Data
                        Store             Store        Store

                       Sqlite             Sqlite        XML
Data Store
                              Context                        Context
                                   User                           User


                                      homeTimeline                   homeTimeline

 Mappa gli oggetti                TimeLine                       TimeLine



 persistenti nel file   timeLine       loadedStatus    timeLine       loadedStatus

                         Status              Status     Status              Status


     associato
                           1                   n          1                   n




                                             Coordinator


                        Data              Data         Data              Data
                        Store             Store        Store             Store

                       Sqlite             Sqlite        XML                 Bin
NSPeristentDocument
                                          Document
                          Context                         Context
                                User                           User


                                   homeTimeline                   homeTimeline

                               TimeLine                       TimeLine

                  timeLine         loadedStatus    timeLine       loadedStatus

                      Status              Status     Status              Status
                        1                   n          1                   n




                                          Coordinator


                   Data                Data         Data              Data
                   Store               Store        Store             Store

                  Sqlite               Sqlite        XML                 Bin
NSPeristentDocument

È possibile configurare                          Document
                                 Context                        Context
 il persistent stack da               User                           User


         codice.                         homeTimeline                   homeTimeline

                                     TimeLine                       TimeLine

                          timeLine       loadedStatus    timeLine       loadedStatus

                            Status              Status     Status              Status
                              1                   n          1                   n




                                                Coordinator


                           Data              Data         Data              Data
                           Store             Store        Store             Store

                          Sqlite             Sqlite        XML                 Bin
NSPeristentDocument

È possibile configurare                          Document
                                 Context                        Context
 il persistent stack da               User                           User


         codice.                         homeTimeline                   homeTimeline

                                     TimeLine                       TimeLine

                          timeLine                       timeLine

   Per applicazioni
                                         loadedStatus                   loadedStatus

                            Status              Status     Status              Status
                              1                   n          1                   n

  document-based
NSPeristentDocument                             Coordinator


                           Data              Data         Data              Data
                           Store             Store        Store             Store

                          Sqlite             Sqlite        XML                 Bin
NSPeristentDocument

È possibile configurare                          Document
                                 Context                        Context
 il persistent stack da               User                           User


         codice.                         homeTimeline                   homeTimeline

                                     TimeLine                       TimeLine

                          timeLine                       timeLine

   Per applicazioni
                                         loadedStatus                   loadedStatus

                            Status              Status     Status              Status
                              1                   n          1                   n

  document-based
NSPeristentDocument                             Coordinator


                           Data              Data         Data              Data
mapping one-to-one         Store             Store        Store             Store

document-data store       Sqlite             Sqlite        XML                 Bin
Domanda
Domanda

Ok, ma come indico a CoreData quali
    sono gli oggetti da rendere
            persistenti?
Domanda

Ok, ma come indico a CoreData quali
    sono gli oggetti da rendere
            persistenti?


  NSManagedObjectModel
Domanda

Ok, ma come indico a CoreData quali
    sono gli oggetti da rendere
            persistenti?


  NSManagedObjectModel

Rappresenta il modello degli oggetti
            persistenti
Opzione 1: Editor Grafico
Opzione 1: Editor Grafico




                       an ,
                         ks
                     Th No
Opzione 2: Da codice
Opzione 2: Da codice




                       k!
                       O
Opzione 2: Da codice




                            k!
                         O
     [esempio PersistenceStack]
Conclusioni: Principi
Conclusioni: Principi

È fondamentale curare il design:
Conclusioni: Principi

È fondamentale curare il design:
•No alle duplicazioni
Conclusioni: Principi

È fondamentale curare il design:
•No alle duplicazioni
•Alta coesione e basso accoppiamento
  degli oggetti
Conclusioni: Principi

È fondamentale curare il design:
•No alle duplicazioni
•Alta coesione e basso accoppiamento
  degli oggetti

     La flessibilità di Objective-c aiuta
Conclusioni: In pratica
Conclusioni: In pratica

    Nello specifico dell’iPhone SDK:
Conclusioni: In pratica

    Nello specifico dell’iPhone SDK:

Costruzione delle relazioni del MVC nel
                 codice
Conclusioni: In pratica

    Nello specifico dell’iPhone SDK:

Costruzione delle relazioni del MVC nel
                 codice

  Costruzione del persistence stack nel
                 codice
Domande?
Presentazione
Presentazione
Presentazione




      http://www.snoopal.com

Mais conteúdo relacionado

Último

Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Associazione Digital Days
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Associazione Digital Days
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Associazione Digital Days
 
ScrapeGraphAI: a new way to scrape context with AI
ScrapeGraphAI: a new way to scrape context with AIScrapeGraphAI: a new way to scrape context with AI
ScrapeGraphAI: a new way to scrape context with AIinfogdgmi
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Associazione Digital Days
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Associazione Digital Days
 

Último (6)

Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
Alessio Mazzotti, Aaron Brancotti; Writer, Screenwriter, Director, UX, Autore...
 
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
Luigi Di Carlo, CEO & Founder @Evometrika srl – “Ruolo della computer vision ...
 
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
 
ScrapeGraphAI: a new way to scrape context with AI
ScrapeGraphAI: a new way to scrape context with AIScrapeGraphAI: a new way to scrape context with AI
ScrapeGraphAI: a new way to scrape context with AI
 
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
Federico Bottino, Lead Venture Builder – “Riflessioni sull’Innovazione: La Cu...
 
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
Daniele Lunassi, CEO & Head of Design @Eye Studios – “Creare prodotti e servi...
 

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Applicazione iPhone con utilizzo di CoreData e UIKit

  • 1. Applicazione iPhone con utilizzo di UIKit e CoreData Giannandrea Castaldi Software Engineer in Exmachina.ch giannandrea.castaldi@exmachina.ch http://www.exmachina.ch
  • 3. Obiettivo Design e pratiche utilizzate nello sviluppo di applicazioni iPhone
  • 4. Obiettivo Design e pratiche utilizzate nello sviluppo di applicazioni iPhone Come utilizzare UIKit quasi esclusivamente da codice
  • 5. Obiettivo Design e pratiche utilizzate nello sviluppo di applicazioni iPhone Come utilizzare UIKit quasi esclusivamente da codice Come definire il persistent stack di CoreData da codice
  • 10. XCode: IDE di sviluppo
  • 11. XCode: IDE di sviluppo k! O
  • 13. IB: Graphical editor per GUI n h io it ut t w ca bu k, O
  • 15. Interface Builder No RAD (Rapid Application Development)
  • 16. Interface Builder No RAD (Rapid Application Development) No RGD (Rapid Gui Development)
  • 17. Interface Builder No RAD (Rapid Application Development) No RGD (Rapid Gui Development) Alla lunga paga di più fare direttamente tutto da codice
  • 18. Interface Builder Jonathan Zdziarski: “Many of the properties you’re able to set using IB are reproducible in code. Think of IB as a GUI for code. While IB supports many of the same characteristics you can set up, it not support all”.
  • 20. CoreData model: Editor Grafico an , ks Th No
  • 22. CoreData model: da codice k! O
  • 23. CoreData Core Data Programming Guide by Apple: “You typically create the managed object model graphically using Xcode's Data Model Design tool. (If you wish you can construct the model programmatically at runtime.)”.
  • 24. i4twitties [Demo e Project overview]
  • 25. UIKit
  • 26. UIKit UIKit fornisce gli oggetti necessari per:
  • 27. UIKit UIKit fornisce gli oggetti necessari per: •eseguire applicazioni grafiche
  • 28. UIKit UIKit fornisce gli oggetti necessari per: •eseguire applicazioni grafiche •MVC: visualizzare i contenuti sul video
  • 29. UIKit UIKit fornisce gli oggetti necessari per: •eseguire applicazioni grafiche •MVC: visualizzare i contenuti sul video •MVC: gestire le azioni dell’utente
  • 30. UIKit: UIWindow [esempio MainWindow]
  • 31. UIKit: UIView [esempio UserCatalogViewController]
  • 35. UIKit: UIViewController Due responsabilità: •visualizzare il modello sulla vista •far evolvere il modello sulla base delle azioni dell’utente
  • 36. UIKit: UIViewController Due responsabilità: •visualizzare il modello sulla vista •far evolvere il modello sulla base delle azioni dell’utente [esempio TimeLineViewController con utilizzo di UITableView]
  • 37. UIKit: UINavigationController [esempio MainWindow]
  • 38. CoreData Offre la gestione del ciclo di vita di oggetti persistenti. La persistenza può essere su file Sqlite, xml e binari.
  • 39. CoreData: NSManagedObject User homeTimeline TimeLine timeLine loadedStatus Status Status 1 n
  • 40. CoreData: NSManagedObject User Oggetti del modello persistenti homeTimeline TimeLine timeLine loadedStatus Status Status 1 n
  • 41. CoreData: NSManagedObject User Oggetti del modello persistenti homeTimeline TimeLine Insieme formano un timeLine loadedStatus grafo di entità e Status 1 Status n relazioni
  • 42. NSManagedObjectContext Context Context User User homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n
  • 43. NSManagedObjectContext Legge/scrive/rimuove Context Context gli oggetti dalla User User persistenza homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n
  • 44. NSManagedObjectContext Legge/scrive/rimuove Context Context gli oggetti dalla User User persistenza homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Con un context si Status 1 Status n Status 1 Status n agisce su sezioni degli oggetti persistenti
  • 45. NSPersistentStoreCoordinator Context Context User User homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n Coordinator
  • 46. NSPersistentStoreCoordinator Context Context Presenta al context gli User homeTimeline User homeTimeline object store sottostanti TimeLine TimeLine come un’unico store timeLine Status loadedStatus Status timeLine Status loadedStatus Status 1 n 1 n Coordinator
  • 47. NSPersistentStoreCoordinator Context Context Presenta al context gli User homeTimeline User homeTimeline object store sottostanti TimeLine TimeLine come un’unico store timeLine Status loadedStatus Status timeLine Status loadedStatus Status 1 n 1 n Un context può creare un grafo di oggetti distribuiti su più data Coordinator store.
  • 48. Data Store Context Context User User homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n Coordinator
  • 49. Data Store Context Context User User homeTimeline homeTimeline Mappa gli oggetti TimeLine TimeLine persistenti nel file timeLine loadedStatus timeLine loadedStatus Status Status Status Status associato 1 n 1 n Coordinator
  • 50. Data Store Context Context User User homeTimeline homeTimeline Mappa gli oggetti TimeLine TimeLine persistenti nel file timeLine loadedStatus timeLine loadedStatus Status Status Status Status associato 1 n 1 n Coordinator Data Store Sqlite
  • 51. Data Store Context Context User User homeTimeline homeTimeline Mappa gli oggetti TimeLine TimeLine persistenti nel file timeLine loadedStatus timeLine loadedStatus Status Status Status Status associato 1 n 1 n Coordinator Data Data Store Store Sqlite Sqlite
  • 52. Data Store Context Context User User homeTimeline homeTimeline Mappa gli oggetti TimeLine TimeLine persistenti nel file timeLine loadedStatus timeLine loadedStatus Status Status Status Status associato 1 n 1 n Coordinator Data Data Data Store Store Store Sqlite Sqlite XML
  • 53. Data Store Context Context User User homeTimeline homeTimeline Mappa gli oggetti TimeLine TimeLine persistenti nel file timeLine loadedStatus timeLine loadedStatus Status Status Status Status associato 1 n 1 n Coordinator Data Data Data Data Store Store Store Store Sqlite Sqlite XML Bin
  • 54. NSPeristentDocument Document Context Context User User homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n Coordinator Data Data Data Data Store Store Store Store Sqlite Sqlite XML Bin
  • 55. NSPeristentDocument È possibile configurare Document Context Context il persistent stack da User User codice. homeTimeline homeTimeline TimeLine TimeLine timeLine loadedStatus timeLine loadedStatus Status Status Status Status 1 n 1 n Coordinator Data Data Data Data Store Store Store Store Sqlite Sqlite XML Bin
  • 56. NSPeristentDocument È possibile configurare Document Context Context il persistent stack da User User codice. homeTimeline homeTimeline TimeLine TimeLine timeLine timeLine Per applicazioni loadedStatus loadedStatus Status Status Status Status 1 n 1 n document-based NSPeristentDocument Coordinator Data Data Data Data Store Store Store Store Sqlite Sqlite XML Bin
  • 57. NSPeristentDocument È possibile configurare Document Context Context il persistent stack da User User codice. homeTimeline homeTimeline TimeLine TimeLine timeLine timeLine Per applicazioni loadedStatus loadedStatus Status Status Status Status 1 n 1 n document-based NSPeristentDocument Coordinator Data Data Data Data mapping one-to-one Store Store Store Store document-data store Sqlite Sqlite XML Bin
  • 59. Domanda Ok, ma come indico a CoreData quali sono gli oggetti da rendere persistenti?
  • 60. Domanda Ok, ma come indico a CoreData quali sono gli oggetti da rendere persistenti? NSManagedObjectModel
  • 61. Domanda Ok, ma come indico a CoreData quali sono gli oggetti da rendere persistenti? NSManagedObjectModel Rappresenta il modello degli oggetti persistenti
  • 62. Opzione 1: Editor Grafico
  • 63. Opzione 1: Editor Grafico an , ks Th No
  • 64. Opzione 2: Da codice
  • 65. Opzione 2: Da codice k! O
  • 66. Opzione 2: Da codice k! O [esempio PersistenceStack]
  • 69. Conclusioni: Principi È fondamentale curare il design: •No alle duplicazioni
  • 70. Conclusioni: Principi È fondamentale curare il design: •No alle duplicazioni •Alta coesione e basso accoppiamento degli oggetti
  • 71. Conclusioni: Principi È fondamentale curare il design: •No alle duplicazioni •Alta coesione e basso accoppiamento degli oggetti La flessibilità di Objective-c aiuta
  • 73. Conclusioni: In pratica Nello specifico dell’iPhone SDK:
  • 74. Conclusioni: In pratica Nello specifico dell’iPhone SDK: Costruzione delle relazioni del MVC nel codice
  • 75. Conclusioni: In pratica Nello specifico dell’iPhone SDK: Costruzione delle relazioni del MVC nel codice Costruzione del persistence stack nel codice
  • 76.
  • 80. Presentazione http://www.snoopal.com

Notas do Editor