Swift exam study guide

Swift exam study guide

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

Redraw on bounds change

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (24)

Section 1

(24 cards)

Redraw on bounds change

Front

when a UIView's bounds changes, there is no redraw. You can control it with var contentMode: UIViewContentMode - don't scale the view just place the bits somewhere then scale the bits of the view.

Back

protocol

Front

A type that is declaration of functionality only. No data storage. Provides multiple inheritance of functionality.

Back

UIView Animation

Front

properties can be animated over time: frame/center, bounds, transform, alpha, backgroundColor. Define animation parameters and pass an animation block(closure). Blocks contain code that make changes to the UIViews. Must have "completion block" to be executed when animation is complete.

Back

Closure Capture

Front

primarily used to prevent a memory cycle.

Back

Memory Cycle Avoidance

Front

using action & avoiding a memory cycle. Could use "unowned" to break a cycle.

Back

protocol use

Front

a collection of method and property declarations. Good for making APIs more flexible and expressive. Blind, structured communication between View & Controller

Back

Navigation controller

Front

A specialized view controller subclass that manages transitions backward and forward through a series of view controllers. Pushes and pops MVCs off of a stack. Back buttons placed auto by Navigation controller

Back

struct

Front

value type. Copy on write. No inheritance of data. Mutability controlled by let. Supports functional programming design

Back

enum

Front

discrete set of values. Can only have associated data as storage. Value type. Can only have methods & computed properties

Back

Dynamic Animation

Front

var animator = UIDynamicAnimator(referenceView: UIView)

Back

Class

Front

supports object oriented design. Inheritance of functionality & data. Reference type. Heap kept clean by Swift

Back

Behaviors

Front

Finding out when a collision happens: var collisionDelegate: UICollisionBehaviorDelegate

Back

Tuple

Front

A grouping of values. You can use it anywhere you can use a type.

Back

Any

Front

special type. Variables of type any can hold something of Any type. Can't invoke a method on Any with Swift. Can't use it directly so must convert to a known type. Conversion done with "as?". The conversion generates an optional

Back

Segues

Front

makes it so that one MVC can cause another to appear. They always create a new instance of an MVC. I.e the detail of a split view will get replaced with a new instance of that MVC. Going "back" is not a segue. Must prepare for a segue by calling it in the Instigator's controller

Back

Gestures

Front

Recognized by instances of UIGestureRecognizer. 1) add a gesture recognizer to a UIView (Controller) 2) provide a method to handle that gesture (UIView or Controller)

Back

delegation

Front

protocol use to implement blind communication between View & Controller.

Back

Tab bar controller

Front

Lets user choose between different MVCs. Auto presents UI for user to manage the overflow if there are too many tabs.

Back

Kinds of Animation

Front

UIView Properties, Controller transitions, Core Animation, OpenGL and Metal, SpriteKit, Dynamic Animation

Back

Split View controller

Front

Places two MVCs side by side. Split view only works properly on iPad, have to include Navigation controllers so it will work on iPhone

Back

NSAAttributedString

Front

Objective-C class. It is a class, not a struct. NSMutableAttributedString to get mutability since it isn't a value type.

Back

String

Front

characters in a string. The index to a String cannot be an Int. Use: startIndex, endIndex, & index(of:). Also a collection of characters

Back

Accessing the sub-MVCs

Front

via the ViewController's property. Every ViewController knows the split view, tab bar, or navigation controller it's currently in.

Back

View Coordinate System

Front

Origin is upper left. Units are points not pixels. Points are the units in the coordinate system. Boundaries of where drawing happens: var bounds: CGRect - a view's internal drawing space's origin and size. CGRect - rectangle containing the drawing space in its own coordinate system

Back