IOS Fundamentals & Data Persistence Flashcards
What are apps?
Apps are bundles of files, they’re individual items held together in a file and bundled.
What does swiftUI get rid of?
Storyboards
What is complied code that makes up an app formed of?
- Unique code
- frameworks
- info.plist configuration file
How do we get resources in IOS such as images, sounds etc?
By using asset libraries
When you create a swift program what does xcode automatically generate?
xcode automatically generates the basic files for a project of the selected type
Which file does main typically reference?
- AppDelegate.swift as this is the main entry point for your application
What are the two functions of the AppDelegate.swift source file?
- to create an entry point and run loop for your app (equiv to main() in programs)
- defines AppDelegate class which is the blueprint for an app. It creates window where app content is drawn. You write your custom app level code here
What does the app delegate do when you go into another app on your phone?
It keeps the previous app running in the background as it may need to complete some tasks/it may have more processing to do, such as storing information, before it completely terminates.
What is a Delegate?
code that provides some additional functionality by providing specific methods, which can be invoked when required by another class.
- Apple asks your delegate to do things on your behalf because it can only provide so much functionality. Your app is original, so you have to define what’s original about it by customising your delegate code.
What is an app Delegate?
- A single delegate object that provides specific methods to handle events that occur as part of the lifecycle of an App
- E.g. your App starting up. Your App’s window contents being drawn on the screen. Your App closing down. etc…
What does the ViewController.swift do?
This stores all the information about what’s displayed in our app
What type of code is placed in ViewController.swift
- IBOutlets (labels etc.) and IBActions (buttons)
- Class and Structure names start with A-Z
- Method names start a-z
What is UIKit?
- It defines the core components of an iOS application
- it’s specific to iOS (can’t be used for macOS for example)
- most UIKit classes can only be used from the app’s main thread
What is iInside a Swift iOS app
- It has a series of states pre-defined, those are still there but they have been moved to another file
- When you tap on an app on your phone, the process moves into the foreground
- When you then go into another app, the process transitions into the background, and finishing doing the processing it needs to before being suspended/terminated
What is delegation?
A design pattern where a host object embeds a “pointer” to another object (the delegate), and sends messages when input etc is required
What are the two required methods used in a tableView?
- number of rows
- number of sections in the table (if you don’t provide this it has a default of 1)
how does swift save memory and processing time when implementing tableViews?
Swift only draws out as many items as are visible on the screen to save memory space/processing time
- When the items we first drew up are no longer visible on the screen, they are disregarded.
-When tables are drawn, only the content on the screen is required from the delegate.
What are views?
they are rectangular areas on screen that handle events and display content
What are viewControllers?
They are special controllers that manage views?
What does the UIKit framework do?
- It defines the main layer of classes an application needs to construct and manage it’s interfaces
What are touch events?
- When the user touches the screen
- could be touchesBegan, touchesMoved, touchesEnded, touchedCancelled
- Touch events are a whole series of touch movements
What does the UIGestureRecogniser do?
It allows you to detect very gentle touches/motion on the screen such as a long press, a double tap or a swipe
What does the Navigation Bar allow you to do?
- Allows you to progress through a structure, giving more specific related detail on every next step of the hierarchical structure. For example Settings in IPhone.
- They use the screen the most effectively by hiding complexity from the user. Too many options on the page may confuse them.
What does the search Bar allow you to do?
- Used to search through a large collection of values
- prominent or minimal styles
- minimal search bars don’t expand until tapped on
What does the tab Bar allow you to do?
- at the bottom of the screen
- quickly switch between sections
- tabs hide complexity
- no hierarchy between tabs
What does the toolbar allow you to do?
- at the bottom of the screen
- buttons for performing actions
- used for performing actions relevant to what’s displayed on the screen.
- no hierarchy
What do action sheets allow you to do?
- specific alert (like delete photo or keep photo)
- Used when we need the user to make a choice (and we may want to warn then about the choice they’re making)
- These are generated dynamically so you choose how many options are provided
- It’s better not to include too many options that will confuse/overload the user
What is the MVC Design pattern?
The model, view controller design pattern classifies objects according to the role they play in the app.
- code is more reusable due to this because it minimises dependencies, you can take a model or view class you’ve already written and use it elsewhere
What are model objects?
They encapsulate data and basic behaviour (data hiding)
What are view objects?
- What the user looks at
- presents information to the user
What are controller objects
Controller objects tie the model to the view
What is the role of the controller?
- it’s the code that connects the model with the view components as these two are unware of each other’s existence
Where do we write in / put most of our code
The view controllers
Describe the model component
- Contains your underlying data and object model
- actions on the model manage the app data and it’s state
- not reliant on an interface
Describe the view component
- What you see on the user interface
- does not store any data
- the canvas itself, place buttons, labels and other views on it
- view controller can be used to update the model component
Describe the controller component
- handles information flow between the model and the view components
- when the model changes it lets the view know
Why is the controller in a MVC rarely reusable?
- Because they’re typically app specific
What are outlets?
They allow your code to access the value of interface objects
How are views typically arranged?
- In a hierarchical structure
- every view has one superview
- every view has zero or more subviews
- views live inside of a window UIwindow)
What is a UIResponder
UIResponder is something that can respond to an event
What is flipped in view related structures?
The coordinate system is flipped - (0,0) is in the top left corner instead of bottom left
- So x and y increase as you go downwards
- You can type coordinates in as you usually would however as the OS automatically flips them for you
What is the difference between frame and bounds?
Frame is the location within the enclosing view
Bounds i.e. the origin on whether the frame or the bound system is used