Interactive App Building Flashcards
Which of the following segues adds a new view to the navigation stack? Present Modally, Present as popover, Show
Show
TF: When we want to show a view, we add the view to the navigation stack
False
Why do we use a navigation stack rather than a modal view for our information flow?
A modal view is used to display temporary information
A modal view is used to draw the users attention and prevents them from taking any action unless the modal is dismissed.
A navigation stack is used to display hierarchical or organized data like our story.
How does a navigation controller object manage the currently displayed screens?
Using the navigation stack, which is represented by an array of view controllers
TF: You cannot interact with the navigation bar. It is entirely managed by the system.
False
TF: When we want to show a view, we add the view to the navigation stack?
False
TF: A tuple in swift is also known as an anonymous struct.
True
What’s the difference if we add an image like this -> UIImage(named: “Home”) as opposed to the pic with the name( can’t put it in here but the image comes up in xcode)?
if we return the image like this -> UIImage(named: “Home”) -> This an optional and must be force unwrapped.
If you have 2 functions with the same name, but different parameters for the function, what is this called?
Method overloading
Under the hood in Swift a tuple is just:
Struct without a name
An optional is a(n) ________ under the hood with a ______ and _________ case
Enum
Some
None
What is a selector?
A name used to select a method to execute for an object
Why do we set a view’s translatesAutoresizingMaskIntoConstraints property to false?
The system adds its own constraints to views which might conflict with ours
TF: We can only apply styles to the entire attributed string. It is not possible to style a particular section of a string.
False
Before we can add constraints to any views we create, which of the following tasks is required:
Adding the created view as a subview of the main view.
How do we modify the appearance of an attributed string?
Using a dictionary of attributes that we associate with the string
Why can we access self inside our closure when we mark the property as lazily loaded?
Lazy loaded properties are created after object initialization meaning self is available to access.
TF: var someProperty = 1 is the same as var someProperty = { return 1 }()
True
TF: Refactoring is the process of changing the structure of our code and changing functionality
False
Why do we use a delegate pattern to be notified of the text field’s events?
Because at most only a single object needs to know about the event
How do we send additional information along with a notification?
Using the userInfo dictionary property
TF: By default every app has its own notification center that manages notifications and observers
True
Which of the following communication methods allows for a loosely coupled, one-to-many pattern? Calling a method on an object, Notifications, Target-Action, Delegates
Notifications
TF: Passing the memory address of a file rather than a value allows us to work on large files without affecting memory usage
True
How is an inout parameter different from a regular parameter?
Inout passes by reference while a regular parameter passes by value
If I wanted to create a type called Degree that was represented as a Double, how would I do that?
typealias Degree = Double