App Development with IOS Midterm

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

App Protocol

(appName.swift) is the starting point for an iOS app

Constants cannot change

(immutable)

Variables can be changed

(mutable)

Swift

(released in 2014) is the programming language of choice for iOS development

SwiftUI

(released in 2019) is the declarative framework used to create user interfaces in iOS development

Classes encapsulate

- Properties (related data) - Behaviors (related actions)

Optional types store one of two things:

- a value of the correct data type - nil

String

A series of characters

Storyboards

A storyboard (visual representation of the app's interface - all scenes and their connections)

A Picker takes two parameters

A string describing its function - A state variable that holds the value selected

+=

Add and assign

Arrays

An array is an ordered collection that stores multiple values of the same type

=

Assign

Toggle View

Toggle views are controls that switch between "on" and "off" states

Bool

Boolean value that is either true or false

a...b

Closed Range Operator defines a range that runs from a to b, useful for for-in loops, if and switch statements, etc.

Constants and Variables

Constants and variables associate a name with a value of a particular type (such as the number 20 or the string "Hello")

Xcode

Xcode is an integrated development environment that allows you to build, test, and deploy iOS apps

+

addition

SwiftUI

Declarative - Uses Swift syntax - Allows more programmatic control of the interface via bindings

/=

Divide and assign

/

Division

e has a precision of at least 15 decimal digits

Double

@EnvironmentObject

allows properties to be stored as shared data that can be accessed by multiple related views

%=

Find remainder and assign

can be as little as 6 decimal digits

Float

&&

and

cannot provide that level of control but can provide simpler code by taking advantage of the power of closures

ForEach loops

a..

Half-Open Range Operator defines a range that runs from a to b, but does not include b (e.g. up to but not including the second value)

Int

Integer - whole number (positive and negative)

Model-View-ViewModel (MVVM)

It uses data bindings to communicate between the View and Model - that binding architecture is referred to as the ViewModel

Add a new item to the end of an array with

append

Classes and Structures

are general-purpose, flexible constructs that can be used as building blocks in your code

Closures

are self-contained blocks of functionality that can be passed around and used in your code

Functions

are self-contained chunks of code that perform a task

Optionals

are the way that Swift handles nil (empty) values

Initializers

are used to create a new instance of a particular type

Integers

are whole numbers with no fractional component (42 and -23) they are either signed (positive, zero, or negative) or unsigned (positive or zero)

We call the class that inherits the

child class or subclass

are blueprints for objects

classes

You can declare multiple variables or constants using a

comma

The value cannot be changed once it is set

constant

Use let to define a

constant

To find out the number of items in an array

count property

protocol

defines a set of behaviors that are expected of an object in a given situation

You have more precise control flow

for-in loop

argument label

is (optionally) used to label arguments when calling a function

String literal

is a fixed sequence of textual characters inside of double quotes

Array with Literals

is a list of values, separated by commas, surrounded by square brackets

@State

is a property wrapper that tells Swift that this property will change over time as the app runs

Cocoa Touch

is a set of pre-written classes (originally written in Objective-C; progressively being updated to Swift)

value type

is a type whose value is copied when it is assigned to a variable or constant or passed to a function

reference type

is not copied when it is assigned to a variable or constant, or passed to a function

ForEach-In Loop in SwiftUI

is often used to loop over a collection to create views on the screen

parameter name

is used in the implementation of the function

NavigationView

is used to enclose any navigational links that you want to create within your app

What is Swift UI?

its a framework for creating user interfaces that dramatically reduces the amount of setup you need to do yourself for a great UI

Creating a Stepper requires three arguments:

label (string for the label) - value (the @State variable to bind the user input to) - in (the range of the stepper)

Objects communicate through

messages

enumerated

method returns a tuple for each item in an array composed of the index and value for that item

!

not

*

Multiplication

*=

Multiply and assign

Types of Mobile Apps

Native apps are developed purely for one platform • Web apps are developed using HTML 5, CSS, and JavaScript, and can be deployed crossplatform • Hybrid apps are a combination of native and web

If you want to format how numbers are output

NumberFormatter class

Float

Numbers with a fractional component (positive and negative) 32-bit

Double

Numbers with a fractional component (positive and negative) 64-bit

%

Remainder Operator

||

or

A class inherits behaviors and properties from a

parent class

define messaging contracts

protocols

DatePicker View

r allows selection of a date and time

ContentView.swift

represents the initial piece of user interface for the app

Floating-Point Numbers

s are numbers with a fractional component (such as 3.14159, 0.5, and -341.15)

@ObjectBinding

should be used for complex properties such as custom classes

Character

Single character

State

State refers to the current value of an object while the app is running

Concatenating Strings

String values can be concatenated with the concatenation operator (+)

-=

Subtract and assign

What is Swift?

Swift is a contemporary programming language with simpler syntax than Objective-C

design pattern

solves a common software engineering problem; they are abstract (not code)

For-In Loops

The for-in loop performs a set of statements for each item in a sequence (makes it easy to iterate over arrays, dictionaries, strings, etc.)

-

subtraction

Using Array Methods

through its methods and properties, or by using subscript syntax

Boolean isEmpty property

to check whether the count is equal to zero

String Interpolation

to include the name of a variable as a placeholder in a string and to prompt Swift to replace it with the value of that variable Wrap the name in parentheses and escape it with a backslash before the opening parenthesis:

Use insert(_ at:)

to insert a value at a specified index: shoppingList.insert("Maple syrup", at: 0)

Use remove(at: )

to remove a value at a specified index: let mapleSyrup = shoppingList.remove(at: 0)

Functions are not required to return a value

true

Methods are defined as functions within a class or structure

true

Properties are defined as variables or constants within a class or structure

true

Swift uses ------- to work out the appropriate type if a type is not specified

type inference

Declaring an Array

use square brackets around the data type

Creating a Slider requires three arguments:

value (the @State variable to bind the user input to) - in (the range of the slider) - step (by how much the slider should change when the user moves it)

The value can be set to a different value in the future

variable

Use var to define a

variable

If-Else Conditional Statements

• If statements execute if a condition is true var temp = 30 if temp <= 32 { print("It's very cold!") } //prints "It's very cold!"

Modifiers

• They are indented beneath a view and use dot notation


Kaugnay na mga set ng pag-aaral

CH 6: Inventory and Cost of Goods Sold

View Set

HTML and CSS Final Study Guide version 3

View Set

Communicating at Work Ch 1 LS/SB

View Set

Chapter 4: Equilibrium: Where Supply Meets Demand

View Set

Ectoderm I: Neural Tube Formation

View Set