SwiftUI Views Quick Start
SwiftUI Views Quick Start
Z
L
S
O
!
SwiftUl Views
Quick Start
Studio
Version : 14 -JANUARY-2024
As a new member of Big Mountain Studio you now get 10% off all of our SwiftUI books !
SWIFTDATA
SWIFTUI
SWIFTUI
VISUALREFERENCE GUIDE
Visual ReferenceGuide VISUAL PICTURE BOOK REFERENCE
YOUR VISUAL TIME-SAVING REFERENCE SwiftD VISUAL TIME-SAVING REFERENCE
Workin wi SwiftU View VISUALTIME-SAVING REFERENCE ata
g th l s
Working with Data SwiftUl Views Master SwiftData Mastery
Data y
MASTERYI
VIEWS
DATA
UI ery
in Swiftl Mastery WIFTUI DEVELOPERS BigMountainStudio in Swift
UI
ECODING BigMountainStudio BigM ELOPERS BigMountainStudio
MarkMoeykens Mark Moeykens Ma Mo kens
rk ey
MASTERY
COMBINE
SWIFTUI
CORE
Visual ReferenceGuide
DATA
VISUAL TIME-SAVING REFERENCE Core Data VISUAL TIME-SAVING REFERENCE Combi VISUAL TIME-SAVING REFERENCE
SwiftUl ne
Animations SwiftUl Animations Maste Core Data Mastery Mastery Combine Mastery
ry
MASTERY
iOS 16
3
Are you new to Swift and SwiftUI ?
4
Book Quick Links
www.bigmountainstudio.com 5
HOW TO USE
This is a visual REFERENCE GUIDE. Find a screenshot of something you
want to learn more about or produce in your app and then read it and look
at the code.
Read what is on the screenshots to learn more about the views and what
they can do.
You can also read the book from beginning to end. The choice is yours.
6
Conventions
CONVENTIONS
www.bigmountainstudio.com 7
Conventions
Embedded Videos
The ePUB version of the book supports embedded videos.
0:00
www.bigmountainstudio.com 8
Conventions
༡
I created a code color theme based off of another color theme called "Gruvbox ".
If you like this color theme and would like to use it in Xcode then you can find it on my GitHub as a gist here .
www.bigmountainstudio.com 9
SWIFTU
10
Basic Concepts
Basic Concepts
If you are absolutely new to SwiftUI, you should definitely read through this chapter to establish some basic concepts that
you can think with.
www.bigmountainstudio.com 11
Basic Concepts
༡
6:31
View
Concepts
Modifiers:
Title text size Building a UI with SwiftUI
View
• Gray text color consists of using Views and
Modifiers . Traditional methods Modifiers :
www.bigmountainstudio.com 12
Basic Concepts
Stacks are views too. They are views that can have
modifiers applied to them.
www.bigmountainstudio.com 13
Basic Concepts
www.bigmountainstudio.com 14
Basic Concepts
www.bigmountainstudio.com 15
Basic Concepts
www.bigmountainstudio.com 16
Basic Concepts
Layout Examples
Now that you know these layout stacks, you can start to guess
how views like these might be arranged using SwiftUI.
VStack
HStack
www.bigmountainstudio.com 17
Basic Concepts
www.bigmountainstudio.com 18
Basic Concepts
www.bigmountainstudio.com 19
Understanding the Syntax
If you have used Swift in the past, then the SwiftUI syntax may look a little different.
It may not be readily apparent just how this code can even compile. This chapter is to help you understand how the code is
able to work.
www.bigmountainstudio.com 20
Understanding the Syntax
The View
༡
struct BasicSyntax : View {
10:43
var body : some View {
Text ( " Hello World ! " ) // Adds a text view to the screen
There is just one property to implement , In Swift , these are optional under certain
the body property. circumstances .
Hello World!
This is where you design your screens . If not needed , they are usually not used to keep
the code clean or simpler.
www.bigmountainstudio.com 21
Understanding the Syntax
Property Getters
༡
struct Person {
Properties can have a getter and setter. But when a
// Computed read - only property ( no setter , value is not stored )
property has no setter, it's called a " read - only"
var personType : String {
property. get {
And when the property does not store a value , it is return " human "
}
called a "computed " property.
}
This is because the value is computed or generated
}
every time the property is read .
In this example, personType is a computed read- only
property.
www.bigmountainstudio.com 22
Understanding the Syntax
SwiftUI With Property Getters
Since these property changes are optional, you can, for example, write the previous SwiftUI syntax
with a get and return inside the body property. This might look more familiar to you now:
get {
Looking at this code again, you notice the some keyword here.
Normally, when defining a type for a property, you wouldnʼt see this word.
www.bigmountainstudio.com 23
Understanding the Syntax
Opaque Types
Text ( " Hello World ! " ) The keyword some is specifying that it is an opaque type .
In the code example, it is " hard or impossible to understand " which type of view is being returned but
at least you know it is a view.
When this View ( BasicSyntax) is used by iOS to draw the screen , it doesn't have to know that the type
Text is being returned . It is OK with just knowing that some View is being returned and can use that
view to draw the screen .
And so you can return anything in that body property as long as it conforms to the View protocol .
For more information on Opaque Types, I recommend referring to the Swift Programming Language
documentation.
www.bigmountainstudio.com 24
Understanding the Syntax
༡
Here is a way to help you understand opaque types .
You know there are books inside , but you don't know exactly which
books they are . You can't see the titles of the books .
It hides the details of what is inside, but you know they are books and
you can do things with them, like put them on the book shelf.
Box of Views
Some Views
In this case, you have a box of different views .
www.bigmountainstudio.com 25
Understanding the Syntax
7:52 You already know from the previous page that what is returned from the body property is something
that conforms to the View protocol .
But what you also need to know is when returning an opaque type ( using the some keyword ) , is that all
possible return types must all be of the same type .
In most cases you are only returning one type . But you might have a scenario like this :
// The keyword " some " tells us that whatever we return , it has to :
// 1. Conform to the View protocol
// 2. Has to ALWAYS be the same type of View that is returned .
var body : some View {
// ERROR : Function declares an opaque return type , but the return statements
in its body do not have matching underlying types
if isYellow {
return Color.yellow // Color type does not match the Text type
}
return_Text ( " No color yellow " ) Text type does not match the color type
}
}
The body property returns a Color and a Text type. This violates the
X
some keyword.
www.bigmountainstudio.com 26
Understanding the Syntax
༡
7:52 The solution would be to change the views returned so they are all the same TYPE . The body now
returns the same type of view (Color) .
// The keyword " some " tells us that whatever we return , it has to :
// 1. Conform to the View protocol
// 2. Has to ALWAYS be the same type of View that is returned .
if isYellow {
return Color.yellow
}
Now, the body property always returns a Color type.
return Color.clear- This satisfies the some keyword.
}
}
www.bigmountainstudio.com 27
Understanding the Syntax
View Containers
༡
struct Example : View {
9:48
var body : some View {
VStack {
Text ( " Hello World ! " )
Text ( " This Vertical Stack is using a function builder " Note : If you don't specify
} a VStack here , SwiftUI will
}
use one by default .
}
So far, you have learned that body is a computed read - only property and can only return ONE object
that is some View. What if you want to show multiple views though?
You learned earlier about the concept of "container " views . These are views that can contain other
Hello World!
This Vertical Stack is using a function builder views . Remember, the body property can only return one view. You will get an error if you try to return
more than one view in the body property.
In the example above , the VStack (Vertical Stack) is that one view being returned . And that vertical
stack is a container with two more views inside of it .
The VStack is using a " trailing closure ," which just means that it is a code block that is passed into the
initializer to be run by the VStack. You have probably seen this before in Swift , this is not new.
What is new in Swift is the ability to create multiple, new views within the constructor like this . Before
we get into this though , let's better understand how this constructor works .
www.bigmountainstudio.com 28
Understanding the Syntax
༡
struct Example : View {
In Swift, you usually see parentheses during var body : some View {
initialization but with a trailing closure , the VStack {
parentheses are optional . Text ( " Hello World ! " )
You can add them and the code will still work just Text ( " This Vertical Stack is using a function builder " )
fine. }
}
This change may start looking more familiar to you . // Change 1 - Add parentheses and parameter name
struct Example : View {
var body : some View {
VStack ( content : {
Text ( " Hello World ! " )
Text ( " This Vertical Stack is using a function builder " )
})
How does the VStack know how to accept the }
multiple views like this? }
This is new in Swift . To better understand this , take
a look at the VStack's initializer.
// VStack initializer
The alignment and spacing parameters are optional ,
init ( alignment : HorizontalAlignment = .center ,
that is why you don't see them in the examples
spacing : CGFloat ? = nil ,
above. But notice before the content parameter
@ViewBuilder content : ( ) -> Content )
there is @ViewBuilder syntax .
www.bigmountainstudio.com 29
Understanding the Syntax
༡
struct ViewBuilderExample : View {
The @ViewBuilder parameter attribute allows var body : some View {
Swift to build multiple child views from within VStack {
Text ( " View 1 " )
a closure .
Text ( " View 2 " )
iOS 17
Text ( " View 3" )
Text ( " View 4 " )
Text ( " View 5" ) You can now have more than 10
Text ( " View 6 " ) views.
Text ( " View 7" )
Text ( " View 8" )
Text ( " View 9 " )
Text ( " View 10 " )
How many child views can I build within a
Text ( " View 11 " ) // Will no longer cause an error
closure?
}
Before iOS 17 there was a limit of 10 views. With }
iOS 17, there is no longer a limit . }
www.bigmountainstudio.com 30
My Template
If you are completely new to SwiftUI you may wonder what a lot of this code means right at the beginning of the book. I
have “templates” that contains a title, subtitle and a short description on most SwiftUI screens.
I will take you through step-by-step on how I build this template that I use throughout the book. I will describe each one
only briefly because each modifier I apply to the views here are described in more detail throughout the book within their
own sections.
www.bigmountainstudio.com 31
MyTemplate
My Basic Template
7:30
Here is my basic template I use throughout the book to explain views and modifiers .
In the next pages I'm going to explain how this is built in SwiftUI . I want to make sure you understand
these parts because you will see them everywhere in this book .
I want to remove any confusion right at the beginning so it doesn't get in your way to learning the
topics in the book .
Subtitle
(Content of what I am
demonstrating goes here .)
www.bigmountainstudio.com 32
My Template
}
}
Here, you have a Text view. You want to make it larger so you use the font modifier so you can set the
size to a SwiftUI preset size called largeTitle (this is the largest preset size).
There are more ways you can change the size of text that are covered in this book in the Control Views
chapter, in the section called Text.
www.bigmountainstudio.com 33
My Template
Add a VStack
struct AddVStack: View {
var body: some View {
// Only one view can be returned from the body property.
// Add 20 points between views within this container.
VStack(spacing: 20) { // VStack is a container view that can hold up to 10 views
Text("Title")
.font(.largeTitle)
}
}
}
VStack
Spacing
The body property can only return one view.
The VStack has an optional parameter you can
You will get an error if you have two views. use in its initializer to specify how many points
of spacing you want in between views. (Note:
So, you need to use a container view that will spacing does not add spacing to the top or
contain multiple views. The vertical stack bottom of the VStack.)
(VStack) is the perfect choice here.
Now you can add up to 9 more views to the Now, letʼs add the subtitle
VStack.
text.
www.bigmountainstudio.com 34
My Template
༡
struct Subtitle : View {
7:13 var body : some View {
VStack ( spacing : 20 ) {
Text ( " Title " )
· font ( .largeTitle )
Title
Subtitle Subtitle
The subtitle is another text view. This time , you set the size to be the second largest preset size with
the title parameter.
Finally, you modify the view to change the text color to gray. (Note: instead of using Color.gray you
can also use just .gray.)
www.bigmountainstudio.com
MyTemplate
༡
struct Description1 : View {
7:35 var body : some View {
VStack ( spacing : 20 ) {
Text ( " Title " )
· font ( .largeTitle )
The important thing to notice here is it is not a backgroundColor modifier. That does not exist . It is a
background modifier because it adds a layer behind the view.
Color.blue is actually a view. So the background modifier is adding a blue view on a layer behind the text .
We want this view to extend to the edges of the screen . So let's add that next.
www.bigmountainstudio.com 36
My Template
༡
struct Description2 : View {
7:53
var body : some View {
VStack ( spacing : 20 ) {
Text ( " Title " )
.font ( .largeTitle )
To extend the text to the edges of the device , we use the frame modifier. You don't need to set a fixed
value . Instead , you can just modify the text view and say its frame's maximum width can extend to
infinity until it hits its parent's frame and then will stop . Its parent's frame is the VStack .
This is looking good . It would look better though if there was more space around the text that pushed
www.bigmountainstudio.com 37
My Template
༡
struct Description3 : View {
9:12
var body : some View {
VStack ( spacing : 20 ) {
Text ( " Title " )
· font ( .largeTitle )
Padding
Use the padding modifier to add space around a view. Remember, the order of modifiers matter. You
can add the padding modifier anywhere as long as it is BEFORE the background modifier. If it was after
the background , it would add space around the blue background . We want the space between the text
and the background .
www.bigmountainstudio.com 38
MyTemplate
༡
struct Version2 : View {
9:19
var body : some View {
VStack ( spacing : 20 ) {
HeaderView ( " Title " ,
subtitle : " Subtitle " ,
desc : " Short description of what I am demonstrating goes here . " ,
back : .purple , textColor : white )
}
.font ( .title )
}
}
Title
Subtitle
So I made my own view, called HeaderView, where I can pass in the information and it will format it .
If you're interested in how this is done , look in the Xcode project that comes with the paid book bundle
for the file "HeaderView.swift ".
www.bigmountainstudio.com 39
SwiftUI Basics
Now that you understand this basic template I use for demonstrating topics, I will start using it. Be sure to read what is on
each screenshot (or find the text in the code to read).
www.bigmountainstudio.com 40
SwiftUI Basics
Scope and Overriding
struct Refactoring: View {
struct RefactoringBefore: View {
Many times, if you have a var body: some View {
var body: some View {
VStack(spacing: 20) {
modifier being applied to VStack(spacing: 20) {
many views, you can move Text("Refactoring")
Text("Refactoring")
.font(.largeTitle)
.font(.largeTitle) it to a parent view so it is
applied to all child views Text("Reusing Modifiers")
Text("Reusing Modifiers") within the parent. .foregroundStyle(.gray)
.font(.title)
.foregroundStyle(Color.gray) Text("You can put common modifiers on
the parent views to be applied to all the child
Text("You can put common modifiers on views.")
the parent views to be applied to all the child .frame(maxWidth: .infinity)
views.") .foregroundStyle(Color.white)
.font(.title) .padding()
.frame(maxWidth: .infinity) .background(Color.blue)
.foregroundStyle(Color.white) }
.padding() .font(.title) // This font style will be
.background(Color.blue) applied to ALL text views inside the VStack.
} }
} }
}
❓
Why isn't the first Text view affected?
The first Text view has its own font
modifier. This means it overrides the
parent modifier.
www.bigmountainstudio.com 41
SwiftUl Basics
༡
struct Symbols Intro : View {
12:31 24 var body : some View {
VStack ( spacing : 20 ) {
Images Text ( " Images " )
font ( .largeTitle )
Using SF Symbols Text ( " Using SF Symbols " )
. foregroundColor ( .gray )
You will see I use icons or Text ( " You will see I use icons or symbols to add clarity to what I'm demonstrating .
symbols to add clarity to what These come from Apple's new symbol font library which you can browse using an
I'm demonstrating . These come app called ' SF Symbols ' . " )
.frame ( maxWidth : .infinity )
from Apple's new symbol font
.padding ( )
library which you can browse .background ( Color.blue )
using an app called ' SF . foregroundColor ( Color.white )
Symbols ' .
// Use " systemName " when you want to use " SF Symbols "
Image ( systemName : " hand . thumbsup.fill " )
.font ( .largeTitle ) // Make the symbol larger
SF Pro Text - Light - 15.0d5e5 Image ( " SF Symbols " ) // Regular image from Assets.xcassets
SF ProText Light >>
}
.font ( .title )
. ignores SafeArea ( edges : .bottom ) // Ignore the bottom screen bord
hand. }
hand.thumbsup hand.
thumbsup.fill thumbsdown }
hand. Even though an Image view is used to initialize a symbol , you use the font modifier to change its size .
thumbsdown.fill
These symbols actually come from fonts . So use font modifiers to change them . There is a whole
section that covers this . Go here to download and install the SF Symbols app .
www.bigmountainstudio.com 42
SwiftUl Basics
Layers
༡
VStack ( spacing : 40 ) {
10:54 Text ( " Layers " )
.font ( .largeTitle )
I use layers ( background and overlay) early in the book so I want to make sure you understand this
concept .
www.bigmountainstudio.com 43
SwiftUl Basics
༡
struct Shapes : View {
3:39 var body : some View {
VStack ( spacing : 15 ) {
Text ( " Shapes " )
· font ( .largeTitle )
Shapes
Text ( " I'll make shapes , give them color and put them behind other views just for
Short Introduction
decoration . " )
.frame ( maxWidth : .infinity )
I'll make shapes , give them .padding ( )
.background ( Color.blue ) Rounded Rectangle is a common
color and put them behind
other views just for . foregroundStyle ( Color.white ) shape.
decoration .
Text ( " This text has a rounded rectangle behind it " )
. foregroundStyle ( Color.white )
www.bigmountainstudio.com 44
Layout Behavior
In SwiftUI, you may wonder why some views layout differently than others. You can observe two behaviors when it comes to
the size and layout of views:
1. Some views pull in to be as small as possible to fit their content. (I will refer to these as “pull-in” views.)
2. Some views push out to fill all available space. (I will refer to these as “push-out” views.)
Knowing these two behaviors can help you predict what will happen when using the different views.
www.bigmountainstudio.com 45
Layout Behavior
КЯ
Some Views Pull In KY
www.bigmountainstudio.com 46
Layout Behavior
КЯ
Some Views Push Out KY
For the most part , I will be telling you if a view is a push - out view or a pull - in view at the
beginning of the sections .
www.bigmountainstudio.com 47
SEE YOUR WORK
48
Previe Option
w s
As you practice these examples, you might want to see your SwiftUl working on different devices in different modes , including light or dark
mode or with different accessibility settings .
You can do all of this without even having to launch the Simulator.
When using SwiftUl , you get a preview canvas that will show you how your views will render.
www.bigmountainstudio.com 49
Preview Options
or
Code
Canvas MO
or
✓ Canvas XX+
10
Assistant
Preview Canvas Layout arc
Minimap
Authors AOA
Code Coverage
Invisibles
www.bigmountainstudio.com 50
Preview Options
0 Introduction
Text ( " Xcode looks for a struct that conforms to the PreviewProvider protocol and
Previews accesses its previews property to display a view on the Canvas . " )
.frame ( maxWidth : .infinity )
Introduction .padding ( )
.background ( Color.red )
. foregroundColor ( .white )
Xcode looks for a struct that
conforms to the } .font ( .title )
PreviewProvider protocol and }
accesses its previews property
to display a view on the
Canvas. // Xcode looks for PreviewProvider struct
struct Previews_Intro_Previews : PreviewProvider {
// It will access this property to get a view to show in the Canvas ( if the Canvas is shown )
static var previews : some View {
// Instantiate and return your view inside this property to see a preview of it
Previews_Intro ( )
}
}
www.bigmountainstudio.com 51
Preview Options
#Preview iOS 17
Before iOS 17
You will see both examples of these in the companion click it in Xcode and if you see the option " Expand
project . Macro", then you know it's a macro .
www.bigmountainstudio.com 52
Preview Options
Dark Mode
VStack ( spacing : 20 ) {
Text ( " Previews " ) . font ( .largeTitle )
#Preview {
Preview_DarkMode ( )
.preferredColorScheme ( .dark )
}
www.bigmountainstudio.com 53
Preview Options
Previews Previews
Light & Dark Modes Together Light & Dark Modes Together
www.bigmountainstudio.com 54
Preview Options
Changing Devices
Automatic
Recent
iPhone 14 Pro iPhone
iPhone 14 Pro iPhone 14 Pro
By default , your canvas will use the iPad mini 6th generation iPhone 14 Pro Max
simulator you currently have selected iPhone 14
iPhone Dynamic Island
(upper left in Xcode) . You can preview a iPhone 14 Plus
iPhone Touch ID
different device by selecting a different iPhone SE 3rd generation
iPad 11- inch
option from the canvas . iPad
iPad 12.9 - inch
iPad Pro 11 -inch, 4th generation
More iPad Pro 12.9 -inch , 6th generation
www.bigmountainstudio.com 55
Preview Options
Dynamic Type Variants
www.bigmountainstudio.com 56
Preview Options
Orientation Variants 0
Previews
Previews Previews
PreviewInterfaceOrientation
PreviewInterfaceOrientation PreviewInterfaceOrientation
Use
previewInterfaceOrientation Use previewInterfaceOrientation to change your preview to Use previewInterfaceOrientation to change your preview to
to change your preview to landscape mode ( right or left) . landscape mode (right or left) .
landscape mode ( right or
left).
557
www.bigmountainstudio.com
Preview Options
Previews
dynamic type .
Color Scheme
Light Appearance Dark Appearance Landscape Left XXX Large
Dark Appearance
Note: The changes you make in the
Orientation
Canvas Device Settings will apply to ALL
Portrait canvases .
Landscape Left
Landscape Right
Dynamic Type
XXX Large
www.bigmountainstudio.com 58
Preview Options
Environment Overrides
Environment Overrides
If you prefer to see your work in the Simulator then you can access many of the options
Interface Style mentioned through the Environment Overrides options .
This button will show up when you run your app in the debugging toolbar at the bottom
Light Dark of Xcode.
Text
Dynamic Type A A
Accessibility Medium
Accessibility
Increase Contrast
Reduce Transparency
Bold Text
Reduce Motion
On/OffLabels
Button Shapes
Grayscale
Smart Invert
Differentiate Without Color
00 100Views
www.bigmountainstudio.com 59
LAYOUT VIEWS
60
Layout Views
Chapter Quick Links
VStack GeometryReader
LazyVStack LazyHGrid
HStack LazyVGrid
LazyHStack ScrollViewReader
Grid Table
Spacer ViewThatFits
VStack stands for " Vertical Stack ". It is a pull - in container view in which you pass in up to ten views and it will compose
www.bigmountainstudio.com 62
VStack
Introduction
Introduction desc : " A VStack will vertically arrange other views within it . " ,
back : blue , textColor : .white )
A VStack will vertically arrange
other views within it. Text ( " View 1 " )
Text ( " View 2 " )
View 1 Text ( " View 3 " )
Text ( " View 4 " )
View 2
Text ( " View 5 " )
View 3 Text ( " View 6 " )
Text ( " View 7" )
View 4
Text ( " View 8" )
View 5 Text ( " View 9" )
}
View 6
.font ( .title )
View 7 }
}
View 8
www.bigmountainstudio.com 63
VStack
Spacing
Text ( " The VStack initializer allows you to set the spacing between all the views inside the
VStack " )
Spacing .frame ( maxWidth : .infinity )
.padding ()
.background ( Color.blue ) .font ( .title )
. foregroundColor ( .white )
The VStack initializer allows you
to set the spacing between all Image ( systemName : " arrow.up.and.down.circle.fill " )
the views inside the VStack .font ( .largeTitle )
Text ( " The spacing here between all of these views is 80 " )
.font ( .title )
}
www.bigmountainstudio.com 64
VStack
Alignment
VStack ( spacing : 20 ) {
4:21 4 Text ( " VStack " )
.font ( .largeTitle )
Text ( " Alignment " )
· font ( .title )
foregroundColor ( .gray )
VStack Text ( " By default , views in a VStack are center aligned . " )
Alignment
VStack ( alignment : .leading , spacing : 40 ) { Set alignment in the initializer.
Text ( " Leading Alignment " )
By default , views in a VStack
.font ( .title )
are center aligned . Divider ( ) // Creates a thin line ( Push - out view)
Image ( systemName : " arrow.left " )
}
.padding ( )
Leading Alignment
. foregroundColor ( Color.white )
.background ( Rounded Rectangle ( cornerRadius : 10 )
. foregroundColor ( .blue ) )
.padding ( )
www.bigmountainstudio.com 65
This book is a preview of:
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME- SAVINGREFERENCE
ry SwiftUl Views ry
Maste g ntain udio VIFTUI DEVELOPERS BigMountainStudio
Bi Mou St
Mark Moeykens Mastery
Over 1,000 pages of SwiftUI Find out how to implement action sheets , modals , popovers
Over 700 screenshots and video showing you what you can and custom popups
do so you can quickly come back and reference the code Master all the layout modifiers including background and
Learn all the ways to work with and modify images overlay layers, scaling , offsets padding and positioning
See the many ways you can use color as views How do you hide the status bar in SwiftUI ? Find out !
Discover the different gradients and how you can apply them This isjust the tip of the mountain!
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
www.bigmountainstudio.com 66
iOS 14
LazyVStack
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g ntain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mou Stu
k
Mar Moey ke ns
OD
Mastery
preview.
The Lazy Vertical Stack is site to the VStack . It's " lazy" because if you have views scrolling off the screen , SwiftUI will not
load them unless it needsto show them The Stock door at de
In thin The votekoods all child views when
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
displayed .
www.bigmountainstudio.com 67
HStack
E
HStack stands for " Horizontal Stack ". It is a pull - in container view in which you pass in up to ten views and it will compose
www.bigmountainstudio.com 68
HStack
Introduction
HStack {
Text ( " View 1 " )
HStack
Text ( " View 2 " )
Introduction Text ( " View 3 " )
}
An HStack will horizontally }
arrange other views within it . .font ( .title )
}
}
View 1 View 2 View 3
www.bigmountainstudio.com 69
HStack
Spacing
VStack ( spacing : 40 ) {
4:36 4 Text ( " HStack " )
.font ( .largeTitle )
Divider ( )
Spacing: 100
Text ( " Spacing : 100 " )
1 2 .font ( .title )
(3)
HStack ( spacing : 100 ) { Set spacing in the initializer.
Image ( systemName : " 1.circle " )
Image ( systemName : " 2.circle " )
Image ( systemName : " 3.circle " )
} .font ( .largeTitle )
}
www.bigmountainstudio.com 70
HStack
Alignment
Text ( " By default , views within an HStack are vertically aligned in the center . " )
4:38 4
HStack {
HStack
Rectangle ( ) . foregroundColor ( .orange ) .frame ( width : 25 )
Text ( " Leading " )
Vertical Alignment Spacer ( )
Text ( " Center" )
By default , views within an Spacer ()
Text ( " Trailing " )
HStack are vertically aligned in
.padding ( .trailing )
the center. Set alignment in the initializer.
}
.border ( Color.orange )
HStack ( alignment : .top ) {
Rectangle ( ) . foregroundColor ( .orange ) .frame ( width : 25 )
Text ( " Leading " )
Leading Center Trailing
Spacer ()
Text ( " Top " )
Spacer()
Text ( " Trailing " )
Leading Top Trailing .padding ( .trailing )
}
.border ( Color.orange )
HStack ( alignment : .bottom
Rectangle ( ) . foregroundColor ( .orange ) .frame ( width : 25 )
Text ( " Leading " )
Spacer ()
Text ( " Bottom " )
Spacer ()
Text ( " Trailing " )
.padding ( .trailing )
}
Leading Bottom Trailing .border ( Color.orange )
www.bigmountainstudio.com 71
HStack
Text Alignment
Text Alignment
HStack ( alignment : .bottom ) {
Text ( " Hello " )
HStacks have another
Text ( " amazing " )
alignment option to help better .font ( .largeTitle )
align the bottom of text . Text ( "developer ! " )
}
.font ( .body )
Hello amazing developer !
DescView ( desc : " Notice the bottom of the text isn't really aligned above . Use
Notice the bottom of the text
firstTextBaseline or lastTextBaseline instead : " , back : .orange )
isn't really aligned above. Use
firstTextBaseline or HStack ( alignment : .firstTextBaseline ) {
lastTextBaseline instead : Text ( " Hello " )
Text ( " amazing " )
.font ( .largeTitle )
Hello amazing developer ! Text ( " developer ! " )
This will align the text normally.
}
But what's the difference between first and
.font ( .body )
} last text baseline? See on the next page.
.font ( .title )
}
}
www.bigmountainstudio.com 72
HStack
www.bigmountainstudio.com 73
HStack
Customization
HStack HStack {
Text ( " Leading " )
Customizing Text ( " Middle " )
Text ( " Trailing " )
}
HStacks are views that can .padding ( )
have modifiers applied to them .border ( Color.orange ) // Create a 2 point border using the color specified
just like any other view. HStack ( spacing : 10 ) {
Image ( systemName : " 1.circle " )
Image ( systemName : " 2.circle " )
Leading Middle Trailing Image ( systemName : " 3.circle " )
} .padding ( )
www.bigmountainstudio.com 74
HStack
Layout Priority
4:49 When using a horizontal stack with text views within it , there's a chance that text might truncate if
you are not allowing them to wrap . In this case, you can prioritize which one will truncate last with
layout priority. The default value is 0. The higher the number, the higher the priority to have enough
space to not be truncated .
HStack
HStack {
Layout Priority
Text ( " SwiftUI " )
.font ( .largeTitle ) . lineLimit ( 1 ) // Don't let text wrap
Use the layoutPriority modifier Image ( " SwiftUI " )
to give priority to the space a .resizable ( )
view needs to show its content . .frame ( width : 80 , height : 80 )
Text ( " Brings Balance " )
.font ( .largeTitle )
.layoutPriority(1) is set on ' Brings Balance '
.layoutPriority ( 1 ) // Truncate las
}
.padding ( [ . horizontal ] )
Sw... Brings Balance
Divider ( )
HStack {
Text ( " SwiftUI " )
SwiftUI Brings Bal ...
.font ( .largeTitle )
.layoutPriority ( 1 ) // Truncate las
.layoutPriority(1 ) is set on 'SwiftUI ' Image ( " SwiftUI " )
· resizable ( )
.frame (width : 80 , height : 80 )
Note: You can learn more
Text ( " Brings Balance " )
.font ( .largeTitle ) . lineLimit ( 1 ) // Don't let text wrap about layout priority in the
} chapter " Layout Modifiers ",
.padding ( .horizontal ) section " LayoutPriority ".
www.bigmountainstudio.com 75
iOS 14
LazyHStack
SWIFTUI
HALSTERY Visual Reference Guide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
preview.
The Lazy Horizontal Stack is Sumar to the HStack . It's " lazy" because if you have views scrolling off the screen , SwiftUI will
not load them unless it node to show the The Stock do this. The stock loads all child views
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
when displayed .
www.bigmountainstudio.com 76
Depth (Z) Stack
A Depth Stack ( ZStack ) is a pull - in container view. It is a view that overlays its child views on top of each other. ( "Z"
represents the Z - axis which is depth - based in a 3D space . )
You learned earlier about creating layers with the background and overlay modifiers . ZStack is another way to create layers
with views that control their own sizing and spacing .
So , the ZStack is a pull - in container view but you may think it is a push - out view because of the first example but it's
actually the color that is pushing out .
www.bigmountainstudio.com 77
ZStack
Introduction
ZStack {
5:09 4 // LAYER 1 : Furthest back You set depth by the order of
Color.gray // Yes , Color is a view ! the views inside the ZStack .
Introduction
Text ( " ZStacks are great for setting a background color . " )
.frame ( maxWidth : .infinity )
ZStacks are great for setting a .padding ( )
background color. .background ( Color.green )
Text ( " But notice the Color stops at the Safe Areas ( white areas on top and bottom ) . " )
But notice the Color stops at .frame ( maxWidth : .infinity )
the Safe Areas (white areas on .padding ( )
top and bottom ) . .background ( Color.green )
}
.font ( .title )
}
www.bigmountainstudio.com 78
ZStack
ZStack {
12:10
Color.gray
(
VStack ( spacing : 20 ) {
Text ( " ZStack" )
.font ( .largeTitle )
Text ( " Ignoring the Safe Areas will extend a view to fill the whole scene . " )
.frame ( maxWidth : .infinity )
ZStack
.padding ( )
. foregroundColor ( .white )
Ignores Safe Area Edges
.background ( Color.green )
Learn more about what Safe Areas are and ways to ignore edges in the chapter " Layout Modifiers " in the
section " Ignores Safe Area ".
www.bigmountainstudio.com 79
ZStack
Background Problem
Text ( " Having the ZStack edges ignoring the safe area edges might be a mistake .
\ nYou notice that the top Text view is completely under the notch . " )
.frame ( maxWidth : .infinity )
.padding ( )
.background ( Color.green )
www.bigmountainstudio.com 80
ZStack
Background Solution
Text ( " To solve the problem , you want just the color ( bottom layer ) to igore
the safe area edges and fill the screen . Other layers above it will say
within the Safe Area . " )
.frame ( maxWidth : .infinity )
.padding ( )
.background ( Color.green )
Spacer ()
}
.font ( .title )
}
}
}
www.bigmountainstudio.com 81
ZStack
Layering
Rectangle ()
· fill (Color.white.opacity ( 0.6 ) )
.frame ( maxWidth : .infinity , maxHeight : 50 )
Yosemite National Park
www.bigmountainstudio.com 82
ZStack
Aligning
Rectangle ( )
.fill ( Color.white.opacity ( 0.6 ) )
.frame ( maxWidth : .infinity , maxHeight : 60 )
www.bigmountainstudio.com 83
ZStack
Rectangle()
.fill(Color.white.opacity(0.6))
.frame(maxWidth: .infinity, maxHeight: 60)
Alignment Choices
Text("Yosemite National Park")
• center
.font(.title)
.padding() • leading
} • trailing
}
.font(.title) • top
}
}
• bottom
• topLeading
• topTrailing
• bottomLeading
• bottomTrailing
www.bigmountainstudio.com 84
Grid
iOS 16
Grid
SWIFTUI
HALSTERY Visual Reference Guide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste VIFTUIDEVELOPERS BigMountainStudio
BigMountainStudio
k
Mar Moey ke ns Mastery
The grid will layout views in ro lumns . What is different preview.grid and other layout views is that it will remember and maintain
the widths of all the views in each row and apply the same width to all views in that same column .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
Grids are pull - in views, they
www.bigmountainstudio.com 85
Spacer
You may notice that when you add new pull-in views, such as Text views, they appear in the center of the screen. You can
use the Spacer to push these views apart, away from the center of the screen.
www.bigmountainstudio.com 86
Spacer
VStack {
6:55 4 Text ( " Spacer" )
.font ( .largeTitle )
Spacer
Introduction Text ( " Introduction " )
foregroundColor ( .gray )
Spacers push things away
Text ( " Spacers push things away either vertically or horizontally " )
either vertically or horizontally.
↑
Image ( systemName : " arrow.up.circle.fill " )
HStack {
Text ( " Horizontal Spacer" )
Color.yellow
Horizontal Spacer .frame ( maxHeight : 50 ) // Height can decrease but not go higher than 50
}
.font ( .title ) // Apply this font to every view within the VStack
www.bigmountainstudio.com 87
Spacer
<---> <--->
Evenly Spaced
Text ( " Use Spacer to evenly space views horizontally so they look good on any
device . " )
7:07 PM Wed Sep 4 100% ---
Spacer Text ( " After" )
Spacer ()
}
www.bigmountainstudio.com 88
Spacer
VStack ( spacing : 10 ) {
7:14 4 Text ( " Spacer " )
.font ( .largeTitle )
Text ( " Minimum Length " )
Spacer
font ( .title )
Minimum Length foregroundColor ( .gray )
Text ( " You can set a minimum space to exist between views using the minLength modifier on the
Spacer . " )
You can set a minimum space
to exist between views using Text ( " No minLength set ( system default is used ) " )
.bold ()
the minLength modifier on the
HStack {
Spacer. Image ( " yosemite " )
Spacer ()
No minLength set (system default is used) Text ( " This is Yosemite National Park " ) . lineLimit ( 1 )
} .padding ( )
www.bigmountainstudio.com 89
Spacer
<---> <--->
Relative Spacing with Spacers
VStack ( spacing : 5) {
Spacer ()
.frame ( width : 5 ) Spacers are views and can be
.background ( Color.blue ) modified like views .
Text ( " 33% Down " )
33% Down
Spacer ()
.frame ( width : 5)
.background ( Color.blue )
Spacer ( )
.frame ( width : 5 )
.background ( Color.blue )
75% Down }
VStack ( spacing : 5) {
Spacer ( )
.frame (width : 5 )
.background ( Color.blue )
Spacer ()
www.bigmountainstudio.com 90
Spacer
.frame(width: 5)
.background(Color.blue)
Spacer()
.frame(width: 5)
Note: You can also use Spacers horizontally to place
.background(Color.blue)
views a percentage from the leading or trailing sides
Text("75% Down")
Spacer()
of the screen.
.frame(width: 5)
.background(Color.blue)
}
}
}.font(.title)
}
}
www.bigmountainstudio.com 91
GeometryReader
רויוי
8
It is difficult , if not impossible , to get the size of a view. This is where the GeometryReader can help .
The GeometryReader is similar to a push - out container view in that you can add child views to it . It will allow you to inspect
and use properties that can help with positioning other views within it . You can access properties like height , width and safe
area insets which can help you dynamically set the sizes of views within it so they look good on any size device .
www.bigmountainstudio.com 92
Geometry Reader
יים
יום
רויוי רויוי
-0-0- Introduction 00
www.bigmountainstudio.com 93
Geometry Reader
יים
יום
רויוי רויוי
-0-0- 00
Alignment
www.bigmountainstudio.com 94
Geometry Reader
יים
יום
רויוי רויוי
-0-0- 00
Layers
www.bigmountainstudio.com 95
Geometry Reader
יים
יום
רויוי רויוי
-0-0- Getting Size 00
www.bigmountainstudio.com 96
Geometry Reader
יים
יום
רויוי רויוי
-0-0- 00
Positioning
www.bigmountainstudio.com 97
Geometry Reader
יים
יום
רויוי רויוי
-0-0- Getting Coordinates 00
www.bigmountainstudio.com 98
Geometry Reader
יים
יוים
רויוי רויוי
-0-0- Min Mid Max Coordinates 00
minX: 16 midX: 384 maxX: 752 // I'm converting to Int just so we don't have so many zeros
Text ( " minX : \ ( Int ( geometry.frame ( in : .local ) .minX ) ) " )
minY: 492 Spacer ()
Text ( " midX : \ ( Int ( geometry.frame ( in : .local ) .midX ) ) " )
minX midX maxX Spacer ()
minY
Text ( " maxX : \ ( Int ( geometry.frame ( in : .local ) .maxX ) ) " )
}
Text ( " Global Coordinate Space " )
midY: 750 midY
HStack ( spacing : 10 ) {
// I'm converting to Int just so we don't have so many zeros
Text ( " minX : \ ( Int ( geometry.frame ( in : .global ) .minX ) ) " )
Spacer ()
maxY
Text ( " midX : \ ( Int ( geometry.frame ( in : .global ) .midX ) ) " )
maxY: 1,008 Spacer ( )
Text ( " maxX : \ ( Int ( geometry.frame ( in : .global ) .maxX ) ) " )
}
} .padding ( .horizontal )
}
www.bigmountainstudio.com 99
Geometry Reader
יים
CFT
רויוי רויוי
100 Min Mid Max Coordinates Continued 00
www.bigmountainstudio.com 100
Geometry Reader
יים
CFT
רויוי רויוי
100 Safe Area Insets 00
GeometryReader
SafeArealnsets
GeometryReader can also tell you the safe area insets it has .
geometryProxy.safeArealnsets.leading : 48.000000
geometryProxy.safeArealnsets.trailing : 48.000000
geometryProxy.safeArealnsets.top : 0.000000
geometryProxy.safeArealnsets.bottom : 21.000000
HeaderView ( " GeometryReader " , subtitle : " SafeAreaInsets " , desc : " GeometryReader can also tell you the safe area insets it has . " ,
back : .clear )
GeometryReader { geometryProxy in
VStack {
Text ( " geometryProxy.safeAreaInsets.leading : \ ( geometryProxy.safeAreaInsets.leading ) " )
Text ( " geometryProxy.safeAreaInsets.trailing : \ ( geometryProxy.safeAreaInsets.trailing ) " )
Text ( " geometryProxy.safeAreaInsets.top : \ ( geometryProxy.safeAreaInsets.top ) " )
Text ( " geometryProxy.safeAreaInsets.bottom : \ ( geometryProxy.safeAreaInsets.bottom ) " )
}
.padding ( )
}
.background ( Color.pink )
. foregroundColor ( .white )
www.bigmountainstudio.com 101
iOS 14
LazyHGrid
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
preview.
Similar to an HStack, the Lazy Horizontal Grid will layout views horizontally but can be configured to use multiple rows and
scroll off the screen . The ord Illa - vill bar that the childview Juben Quiful needs them . This is
called " lazy loading ". SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 102
iOS 14
LazyVGrid
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
OD
preview.
Similar to an HStack , the Lazy vertical Grid will layout views vertically but can be configured to use multiple columns and
scroll off the screen . Theard illezull bar that the child view tod when Qu needs them . This is
called " lazy loading ". SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $ 49.50!
103
ScrollViewReader
iOS 14
ScrollViewReader
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swif
tUl Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
OD
preview.
UT With this fi
The Scroll View Reader ges ake a view within a
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $ 49.50!
scroll view visible by auto
www.bigmountainstudio.com 104
iOS 15
ControlGroup
Use the Control Group to put similar types of controls together, such as buttons . In my opinion , the use of this seems
limited .
ControlGroup ControlGroup {
Button (" Hello ! " ) { }
Introduction Button ( action : {} ) {
Image ( systemName : " gearshape.fill" )
Use a ControlGroup view to }
group up related controls .
}
Hello!
DescView ( desc : "You can change the default style to ' navigation ' : "' )
ControlGroup {
You can change the default Button ( " Hello ! " ) { }
style to ' navigation ' : Button (action : { } ) {
Image ( systemName : " gearshape.fill " )
Hello! ❤ }
}
Note: You may ask yourself
.controlGroupStyle ( .navigation )
} when you would use this .
.font ( .title )
I think it makes more sense
}
inside of toolbars as well as
}
on macOS .
Table
iOS 16
Table
SWIFTUI
MASTERY Visual Reference Guide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste VIFTUIDEVELOPERS
BigMountainStudio BigMountainStudio
k
Mar Moey ke ns Mastery
OD
preview.
You can bind a collection of objects to a table and then each property to a table column .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
In iOS though you will only s
www.bigmountainstudio.com 107
iOS 16
ViewThatFits
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste BigMountainStudio VIFTUI DEVELOPERS BigMountainStudio
Mark Moeykens Mastery
ViewThatFits is a very unique that can contain multiple views but will only draw one of the views. That's right, it will only draw the
view that fits the space it is g This SwiftUl chapter is locked in this
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
If none of the views fit, the l
www.bigmountainstudio.com 108
ContentUnavailableView
iOS 17
ContentUnavailableView
www.bigmountainstudio.com 109
CONTROL VIEWS
110
Chapter Quick Links
Button LabeledContent Picker SignInWithAppleButton
Button
The Button is a pull - in view with a wide range of composition and customization options to be presented to the user. The
www.bigmountainstudio.com 112
Button
Button Button
Introduction
}
This is the quickest and easiest way to
make a button .
Button {
// Code here
} label : { Use this initializer to customize the
Text ( " Regular Button " ) content within the button .
.bold ( )
Regular Button
}
}
Regular Button
.font ( .title ) // Make all fonts use the title style
}
}
www.bigmountainstudio.com 113
Button
Button Button
Text Composition
Button { } label : {
VStack { You can use any layout or
Forgot
Tap to Recover Text ( " New User" ) container view you want within
Password?
Text ( " ( Register Here ) " ) . font ( .body) the label content .
}
New User
}
(Register Here)
}
font ( .title )
}
}
www.bigmountainstudio.com 114
Button
Button Button
With Backgrounds
www.bigmountainstudio.com 115
Button
Button Button
With Borders
Button ( action : {} ) {
Text ( " Border Button " )
Square Border Button
.padding ( )
.background {
RoundedRectangle ( cornerRadius : 10 )
Border Button ■ stroke ( Color.purple , lineWidth : 2 )
}
}
}
.font ( .title )
}
}
www.bigmountainstudio.com 116
Button
Button Button
With SF Symbols
Button ( action : {} ) {
Search for Wifi
VStack {
Image ( systemName : " video.fill " ) Or use a layout view to
Text ( " Record " ) arrange your text and
Record .padding ( .horizontal ) images .
}
.padding ( )
. foregroundStyle ( Color.white )
.background ( Rounded Rectangle ( cornerRadius : 25 ) )
}
}
.tint ( .purple )
.font ( .title )
For even more ways to customize buttons , see
}
the chapter on Paints where you can learn how
}
to apply the 3 different gradients to them .
www.bigmountainstudio.com 117
Button
Button Button
With Images
Button ( action : {} ) {
www.bigmountainstudio.com 118
Button
.buttonStyle ( .automatic )
Automatic
.buttonStyle ( .bordered )
Bordered
.buttonStyle ( .borderless )
Borderless
.buttonStyle ( .plain )
Plain } Color does not get applied to plain
.font ( .title ) buttons .
.tint ( .purple )
www.bigmountainstudio.com 119
Button
Button ( action : {} ) {
Bordered - Large Text ( " Bordered - Large " ) You can still change the
.frame ( maxWidth : .infinity size manually and the
} shape will be the same.
.controlSize ( .large )
Bordered - Large }
.buttonStyle ( .bordered
.tint ( .purple )
.font ( .title ) Notice how the buttonStyle is on the parent
} view and gets applied to all the child views
} that are buttons .
www.bigmountainstudio.com 120
Button
Normal
.buttonStyle ( .bordered )
.controlSize ( .large )
Cancel
.font ( .title )
www.bigmountainstudio.com 121
Button
}
}
www.bigmountainstudio.com 122
Button
Button Button
Disabled
Enabled
Button ( " Disabled " ) { }
.disabled ( true )
Disabled
Button ( " Enabled " ) { }
.buttonStyle ( .bordered )
Enabled
Button ( " Disabled " ) { }
.buttonStyle ( .bordered )
.disabled ( true )
Disabled
Button ( " Enabled " ) { }
.buttonStyle ( .bordered Prominent )
Enabled
Button ( " Disabled " ) { }
.buttonStyle ( .bordered Prominent )
.disabled ( true )
}
Disabled
.controlSize ( .large )
.font ( .title )
.tint ( .purple )
}
}
www.bigmountainstudio.com 123
Button
With Image
Button ( " With SF Symbol " , systemImage : " paintbrush.pointed.fill " ) { }
.buttonStyle ( .bordered )
Button ( "With Image & Role " , systemImage : " x.circle " , role : .destructive ) { }
With SF Symbol
Button ( "With Image & Role " , systemImage : " x.circle " , role : .destructive ) { }
.buttonStyle ( .bordered Prominent )
With Image & Role }
.controlSize ( .extraLarge )
.font ( .title )
} You can also specify the role with
With Image & Role
} this initializer.
www.bigmountainstudio.com 124
Chart
iOS 16
Chart
SWIFTUI
MASTERY Visual Reference Guide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain udio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo St
k
Mar Moey ke ns Mastery
OD
A Chart is a container view . It c marks " ( representations preview. hich can be drawn in a variety of different ways . There are
many different ways you can configure the chart and marks . This chapter will cover many of those options .
www.bigmountainstudio.com 125
ColorPicker
iOS 14
ColorPicker
This is a push-out horizontalview.SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 126
iOS 14
DatePicker
The date picker provides a way for the user to select a date and time. You bind the selected date to a property. You can
read this property to find out what was selected or set this property for the DatePicker to show the date you want.
(Note: If you have to support the DatePicker for iOS 13, then it will look different from what you see in this chapter.)
www.bigmountainstudio.com 127
DatePicker
Introduction iOS 14
Text("With label:")
}.font(.title)
} What you see here is representative of the compact date picker style
} (text representation of the date).
0:00
There are other styles available…
www.bigmountainstudio.com 128
Date Picker
iOS 14
Styles
VStack ( spacing : 0) {
Graphical Style HeaderView ( " DatePicker " ,
subtitle : " Styles " ,
September 2021 > < >
SUN MON TUE WED THU FRI SAT desc : " Graphical Style " , back : .green )
1 2 3 4
.datepickerStyle ( .graphical
5
12 13 14 15 16 17 18
335
1
19 20 21 22 23 24 25
26 27 28 29 30
DescView ( desc : " Wheel Style " , back : .green )
DatePicker ( " Birthday " , selection : $ date , displayedComponents : .date )
www.bigmountainstudio.com 129
Date Picker
iOS 14
Displayed Components
www.bigmountainstudio.com 130
Date Picker
iOS 14
Displayed in Form
(
11:20 @State private var date = Date ( ) 11:20
DatePicker DatePicker
var body : some View {
Used in a Form VStack ( spacing : 20 ) { Used in a Form
HeaderView ( " DatePicker" ,
When used in a form , the date subtitle : " Used in a Form " , When used in a form , the date
picker uses the compact desc : " When used in a form , the date picker uses the compact
styling by default . picker uses the compact styling by default . " , styling by default .
back : .green )
Form {
Today Sep 18, 2021 DatePicker ( " Today " , selection : $ date , Today Sep 18, 2021
displayed Components : .date )
September 2021 > < >
Graphical Picker Style : SUN MON TUE WED THU FRI SAT
Section {
1 2 3 4
September 2021 > < > Text ( " Graphical Picker Style : " )
SUN MON TUE WED THU FRI SAT DatePicker ( " Birthday " , selection : $ date , 5 6 7 8 9 10 11
1 2 3 4 displayedComponents : .date )
12 13 14 15 16 17 18
.datepickerStyle ( .graphical )
5 6 7 8 9 10 11
1980
} 19 20 21 22 23 24 25
1280
12 13 14 15 16 17 18 }
26 27 28 29 30
288
}
200
.font ( .title )
20
www.bigmountainstudio.com 131
Date Picker
iOS 14
Customizing
(
11:25 .... @State private var date = Date ( )
www.bigmountainstudio.com 132
Date Picker
(
11:53 .... @State private var date = Date ( )
customize the color of the background . Here are some other options though . " , back : .green )
text or background . Here are DatePicker ( " Today " , selection : $ date , displayed Components : .date )
some other options though . .labelsHidden ( )
.background ( Rounded Rectangle ( cornerRadius : 8 , style : .continuous )
.fill ( Color.green ) .opacity ( 0.2 ) )
Sep 18, 2021
DescView ( desc : " What does NOT work : " , back : .green )
Form {
What does NOT work: DatePicker ( " accentColor " , selection : $ date , displayed Components : .date )
.accentColor ( .green )
www.bigmountainstudio.com 133
Disclosure Group
iOS 14
DisclosureGroup
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
The disclosure group gives you o expand and collapse vi preview. it . You supply it with child views that you want collapsed/
expanded.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $49.50 !
This is a pull - in view .
www.bigmountainstudio.com 134
Form
The Form view is a great choice when you want to show settings, options, or get some user input. It is easy to set up and
customize as you will see on the following pages.
www.bigmountainstudio.com 135
Form
Introduction 昌
Limitations
Section {
There are built-in margins that are difficult to Text ( " Limitations " )
get around. Take a look at the color below so
you can see where the margins are: .font ( .title )
Text ( " There are built - in margins that are difficult to get around . Take a look
at the color below so you can see where the margins are : " )
Color.purple
}
Summary
Pretty much what you see here is what
you get. Section {
Text ( " Summary " )
.font ( .title )
Text ( " Pretty much what you see here is what you get . " )
}
}
}
}
www.bigmountainstudio.com 136
Form
((
7:40 var body : some View {
Form {
SECTION HEADER TEXT
Section {
You can add any view in a section header Text ( " You can add any view in a section header " )
Text ( " Notice the default foreground color is gray " )
Notice the default foreground color is gray } header : {
Text ( " Section Header Text " )
}
PEOPLE Section {
Text ( " Here's an example of a section header with image and text " )
Here's an example of a section header with } header : {
image and text SectionTextAndImage ( name : " People " , image : " person.2.square.stack.fill " )
}
Section {
Text ( " Here is an example of a section footer " )
Here is an example of a section footer } footer : {
Total: $5,600.00 Text ( " Total : $ 5,600.00 " ) . bold ( )
}
}
}
www.bigmountainstudio.com 137
Form
I
Header Prominence iOS 15
Section {
Text ( " Use increased header prominence to make it stand out more . " )
} header : {
Text ( " Increased Header Prominence "
}
.headerProminence ( .increased )
}
}
}
www.bigmountainstudio.com 138
Form
www.bigmountainstudio.com 139
Form
Row 2. }
Row 3.
Section {
Text ( " Row 1. " )
Text ( " Row 2. " )
Text ( " Row 3. " )
} header : {
Text ( " Images " )
} Notice when the image is
.listRowBackground ( Image ( " water" )< on the section , it is
.blur ( radius : 3 ) ) repeated for all rows.
}
.font ( .title2 )
}
}
www.bigmountainstudio.com 140
Form
I
List Row Inset
www.bigmountainstudio.com 141
Form
With Controls
www.bigmountainstudio.com 142
Form
www.bigmountainstudio.com 143
Gauge
iOS 16
Gauge
SWIFTUI
MASTERY Visual Reference Guide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
Use the gauge to show a value range . The value and ran preview.shown in a linear or circular way.
www.bigmountainstudio.com 144
GroupBox
iOS 14
GroupBox
SWIFTUI
MASTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste VIFTUIDEVELOPERS BigMountainStudio
BigMountainStudio
k
Mar Moey ke ns Mastery
preview.
The group box is container for grouping similar items together.
The GroupBox is a pull-in SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 145
iOS 14
Label
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $ 49.50!
This is a pull - in view.
www.bigmountainstudio.com 146
LabeledContent
iOS 16
LabeledContent
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
of a label preview. and the control on the right. Think of this view as a template
ve this pattern of
You may have noticed some cove
where you can supply a label on the left and your own content on the right.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
This view pushes out horizo
www.bigmountainstudio.com 147
Link
iOS 14
Link
SWIFTUI
MASTERY Visual Reference Guide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
preview.
The Link is similar to the Button or the NavigationLink except it can navigate you to a place outside your app .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
This is a pull - in view.
www.bigmountainstudio.com 148
List
Using a List view is the most efficient way of displaying vertically scrolling data. You can display data in a ScrollView, as you
will see later on, but it will not be as efficient in terms of memory or performance as the List view.
www.bigmountainstudio.com 149
List
Static Data Text ( " Static Data " ) . font ( .title ) .foregroundColor ( .gray )
Text ( " You can show static views or data within the List view . It does not have to be
bound with data . It gives you a scrollable view . " )
You can show static views or
.frame ( maxWidth : .infinity )
data within the List view. It does .font ( .title ) .padding ( )
not have to be bound with data . .background ( Color.green )
It gives you a scrollable view. . foregroundColor ( .black )
List {
Line One
Text ( " Line One " )
Line Two Text ( " Line Two " )
Text ( " Line Three" )
Line Three
Image ( " profile " )
Button ( " Click Here " , action : {})
.foregroundColor ( .green ) Note: Like other container views ,
HStack { you can now have as many views as
Spacer ()
Click Here you want inside it .
Text ( " Centered Text " )
Spacer ( )
Centered Text
} .padding ( )
}
font ( .title )
}
}
www.bigmountainstudio.com 150
List
With Data
You use this parameter to tell the List how it can uniquely identify each row by which value. The List
needs to know this so it can compare rows by this value to perform different operations like reordering
and deleting rows for us .
In this scenario , we are using " self " to say, "Just use the value of the string itself to uniquely identify
each row. "
www.bigmountainstudio.com 151
List
Custom Rows
။။။
struct List_CustomRows : View {
12:57 var data = [ " Custom Rows ! " , " Evans " , " Lemuel James Guerrero " , " Mark " , " Durtschi " , " Chase " ,
"Adam " , " Rodrigo " ]
Custom Rows !
var body : some View {
List ( data , id : \ .self ) { datum in
Evans CustomRow ( content : datum ) Extracting rows into separate views
} is a common practice in SwiftUl . You
Lemuel James Guerrero } can then have a separate preview
}
just for the row.
Mark struct CustomRow : View {
var content : String
Durtschi
var body : some View {
HStack {
Chase Image ( systemName : " person.circle.fill " )
Text ( content )
Adam Spacer ()
}
. foregroundColor ( content == " Custom Rows ! " ? Color.green : Color.primary )
Rodrigo .font ( .title )
.padding ( [ . top , .bottom ] )
}
}
www.bigmountainstudio.com 152
List
Move Rows
struct List_MoveRow : View {
@State var data = ["Hit the Edit button to reorder", "Practice Coding", "Grocery shopping",
"Get tickets", "Clean house", "Do laundry", "Cook dinner", "Paint room"]
What is EditButton()?
This is a built-in function that returns a view (Button) that will automatically toggle edit mode on the List.
Its text says “Edit” and then when tapped you will see the move handles appear on the rows and the
0:00 button text says “Done”.
www.bigmountainstudio.com 153
List
Delete Rows
.onDelete { offsets in
Practice Coding data.remove ( atOffsets : offsets
}
} header : {
cery shopping Delete Text ( " To Do " )
.padding ( )
}
Get tickets }
.listStyle ( .plain )
}
Clean house }
Do laundry
Cook dinner
www.bigmountainstudio.com 154
List
Selecting a Row
"Clean house " , " Do laundry " , " Cook dinner " , " Paint room " ]
List
@State private var selection : String ?
Practice Coding Allow rows to be selected .
}
Then bind the selection parameter
Text ( " To do first : ") +
to your @State property above using
Text ( selection ?? " " ) the dollar sign ($) .
.bold ( )
.font ( .title )
}
To do first: Clean house
}
www.bigmountainstudio.com 155
List
List "Clean house " , " Do laundry " , " Cook dinner " , " Paint room " ]
O Practice Coding
@State private var selections = Set < String > ( )
By changing the type to a Set , the
Grocery shopping
List will automatically know it can
Get tickets
hold multiple selection values .
Clean house
var body : some View {
O Do laundry
NavigationStack {
✓ Cook dinner
Paint room List ( data , id : \ .self , selection : $ selections ) { item in
Text ( item )
.font ( .title )
.toolbar { EditButton ( ) }
www.bigmountainstudio.com 156
List
"Get tickets " , " Clean house " , " Do laundry " , " Cook dinner " , " Paint room " ]
List
@State private var selection : String ?
Things to do
Practice Coding
var body : some View {
Grocery shopping
NavigationStack {
Get tickets
VStack ( spacing : 0) {
Clean house
List ( data , id : \ .self , selection : $ selection ) { item in
Do laundry
Text ( item )
Cook dinner
.selectionDisabled ( item == " Things to do " )
Paint room
}
}
If you do not want a row to
.font ( .title )
be selected , you can use the
.navigationTitle ( " List " ) selection Disabled modifier.
www.bigmountainstudio.com 157
List
var body : some View { inside the row, not on the List itself.
List {
Cook dinner
Section {
ForEach ( data ) { datum in
Paint room Text ( datum.action )
.font ( Font.system ( size : 24 ) )
.foregroundColor ( self.getTextColor ( due : datum.du
// Turn row green if due today
.listRowBackground ( datum.due == " Today " ? Color.green : Color.clear )
.padding ( )
}
www.bigmountainstudio.com 158
List
} header : {
VStack {
Text ( " To Do " ) . font ( .title )
HStack {
TextField ( " new todo " , text : $ newToDo )
.textFieldStyle ( .roundedBorder )
Button ( action : {
data.append ( Todo ( action : newToDo ) )
newToDo = ||||
}) {
Image ( systemName : " plus.circle.fill " ) . font ( .title )
}
}
}
.padding ( .bottom )
}
}
listStyle ( .plain )
}
// This logic was inline but the compiler said it was " too complex "
private func getTextColor ( due : String ) - > Color {
due == " Today " ? Color.black : Color.primary
}
}
www.bigmountainstudio.com 159
List
To Do
@State var data = [
new todo
Todo ( action : " Practice using List Row Insets " , due : " Today " ) ,
Todo ( action : " Grocery shopping " , due : " Today" ) ,
Practice using List Row Insets
Todo ( action : " Vegetables " , due : " Today " , isIndented : true ) ,
Todo ( action : " Spices " , due : " Today " , isIndented : true ) ,
Grocery shopping
Todo ( action : " Cook dinner " , due : " Next Week " ) ,
Todo ( action : " Paint room " , due : " Next Week " )
Vegetables
]
Spices
var body : some View {
Cook dinner VStack {
VStack {
Paint room
Text ( " To Do " )
.font ( .title )
. foregroundColor ( .black )
HStack {
TextField ( " new todo " , text : $ newToDo )
.textFieldStyle ( .roundedBorder )
Button ( action : {
data.append ( Todo ( action : newToDo ) )
newToDo = ||||
}) {
See next page for the code
Image ( systemName : " plus.circle.fill " ) that insets the rows .
.font ( .title )
www.bigmountainstudio.com 160
List
.foregroundColor ( .white )
}
}
}
.padding ( )
.background ( Color.green )
List {
ForEach ( self.data ) { datum in
Text ( datum.action )
.font ( .title )
.padding ( )
// Inset row based on data
I'm using a condition here to
listRowInsets ( EdgeInsets ( top : 0 ,
determine just how much to inset
leading : datum.isIndented ? 60 : 20
the row.
bottom : 0 , trailing : 0 ) )
}
}
.listStyle ( .plain )
}
}
}
Note : If you want to remove all default Note: If you want a row content to go to
edge insets (setting all to zero ) , you can not be indented at all ( so it touches the
use: edge of the list , then set the leading
.listRowInsets ( EdgeInsets ( ) ) edge to zero .
www.bigmountainstudio.com 161
List
List With Children iOS 14
www.bigmountainstudio.com 162
List
ListStyle : Automatic
www.bigmountainstudio.com 163
Link
Discover even more you can do with a list including : customizing separators (or removing them ) , swipe actions, section separators , safe area
insets , apply tints and header/footer list styles .
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g ntain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mou Stu
k
Mar Moey ke ns Mastery
OD
preview.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
www.bigmountainstudio.com 164
iOS 14
Menu
The Menu view allows you to attach actions toa view. You basically add some buttons (with or without images) and define a
label, or a visible view to the user. When the user taps the label, the actions will show.
This SwiftUI chapter is locked in this
This is similar to the contextMenu modifier (in the ControlsModifiers chapter) where you can attach a menu to any view
that becomes visible when you long-press the view.
preview.
This is a pull-in view. SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 165
MultiDatePicker
iOS 16
MultiDatePicker
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste VIFTUIDEVELOPERS BigMountainStudio
BigMountainStudio
k
Mar Moey ke ns Mastery
SAVE 10 % AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
This is a push - out view.
www.bigmountainstudio.com 166
NavigationStack
iOS 16
NavigationStack
<
The NavigationStack is slightly different in that it will fill the whole screen when used . You will never have to specify its size . It is used to
help you navigate from one screen to another with built- in ways to navigate forward and back . This chapter will also teach you how to use
and customize the navigation stack .
www.bigmountainstudio.com 167
NavigationStack
((
var body : some View {
not show anything if there is no title
NavigationStack { modifier added for it to use.
Image ( systemName : " hand.wave.fill " )
.font ( .largeTitle ) The navigation stack bar is there at
}
}
www.bigmountainstudio.com 168
NavigationStack
}
}
11
www.bigmountainstudio.com 169
NavigationStack
www.bigmountainstudio.com 170
NavigationStack
iOS 15
Custom Background
www.bigmountainstudio.com 171
NavigationStack
iOS 15
UINavigation BarAppearance
((
6:42 www. Use UINavigation BarAppearance to
var body : some View {
NavigationStack { apply style/color to ALL navigation
bars.
VStack {
Appearance
}
.navigationTitle ( " Appearance " )
.font ( .title )
}
.onAppear {
let appearance = UINavigationBarAppearance ( )
Note: You could also set this when the app starts on the very first view of your app .
www.bigmountainstudio.com 172
NavigationStack
www.bigmountainstudio.com 173
NavigationStack
NavigationBarHidden
struct Navigation_BarHidden: View {
@State private var isHidden = false
0:00
www.bigmountainstudio.com 174
NavigationStack
www.bigmountainstudio.com 175
NavigationStack
Go To Detail Go Back
www.bigmountainstudio.com 176
NavigationStack
(Code) NavigationBarBackButtonHidden
// First Screen
struct Navigation_BackButtonHidden: View {
var body: some View {
Use NavigationLink to navigate
NavigationStack {
to a new screen.
NavigationLink("Go To Detail", destination: BackButtonHiddenDetail())
More about NavigationLink in
.font(.title)
.navigationTitle("Navigation Views")
the next section.
}
}
}
// Second Screen
struct BackButtonHiddenDetail: View {
This will allow you to
@Environment(\.dismiss) var dismiss
navigate backward.
var body: some View {
Button("Go Back") {
dismiss() Dismissing what is being presented will
} navigate you back to the previous screen.
.font(.title)
.navigationTitle("Detail View")
// Hide the back button
The back button is hidden. This allows you to create a
.navigationBarBackButtonHidden(true)
custom back button where you might want to add logic to it.
}
}
www.bigmountainstudio.com 177
NavigationStack
((
6:48 var body : some View {
NavigationStack {
NavigationLink ( " Go To Detail " ,
Detail View destination : Navigation_CustomBackButton_Detail ( ) )
.font ( .title )
.navigationTitle ( " Navigation Views " )
}
} Hide the system back
} button and then use toolbar
// Second Screen modifier to add a leading
struct Navigation_CustomBackButton_Detail : View { button .
@Environment ( \ . dismiss ) var dismiss
}
}
}
} Warning: By hiding the back button , you will lose the
A
ability to swipe back to the previous screen .
www.bigmountainstudio.com 178
NavigationStack
Customizing the Nav Bar iOS 14
www.bigmountainstudio.com 179
NavigationSplitView
iOS 16
Navigation SplitView
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
You have probably seen on an macOS an app that has preview.cal panes. In the far left pane you can tap on items that shows
more details to the right . This is a common navigational pattern that can be achieved with the navigation split view .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
This is a push - out view .
www.bigmountainstudio.com 180
NavigationLink
NavigationLink
>
The NavigationLink is your way to navigate to another view. It ONLY works inside of a NavigationView . The appearance is
just like a Button . You can customize it just like you can customize a Button too .
www.bigmountainstudio.com 181
NavigationLink
Introduction
•)
NavigationStack {
VStack ( spacing : 20 ) {
NavigationLink NavigationLink ( " Just Text " , destination : SecondView、
NavigationLink {
SecondView ( )
} label : {
Label ( " Label " , systemImage : " doc.text.fill
}
}
.navigationTitle ( " NavigationLink " )
}
Just Text
.font ( .title )
} You can also use the label
Label
} parameter to customize the
tappable view to trigger
struct SecondView : View { navigation .
var body : some View {
VStack {
Text ( " View 2 " )
These are the basic
.font ( .largeTitle )
} implementations using just text or
a label and a destination . The
.navigationTitle ( " Second View" )
destination can be any view.
}
}
www.bigmountainstudio.com 182
NavigationLink
Customization
www.bigmountainstudio.com 183
NavigationLink
www.bigmountainstudio.com 184
NavigationLink
With Different Types iOS 16
struct NavLink_WithDifferentTypes: View {
var body: some View {
NavigationStack {
VStack(spacing: 16.0) {
NavigationLink(value: "NavigationLink 1") {
Text("Navigate with String")
}
The navigation links will
NavigationLink(value: true) {
automatically link up to
Text("Navigate with Bool") the navigation destination
} modifiers of the same
} type.
.navigationDestination(for: String.self) { stringValue in
Text("Value is: ") + Text("\(stringValue)").bold()
}
.navigationDestination(for: Bool.self) { boolValue in
Text("Value is: ") + Text("\(boolValue.description)").bold()
}
.navigationTitle("Navigation Destination")
}
.font(.title)
}
}
0:00
www.bigmountainstudio.com 185
NavigationLink
isPresented iOS 16
www.bigmountainstudio.com 186
NavigationLink
enum Screens {
You can also use an enum to keep
case screen1
case screen2 track of all of your screens .
case screen3
}
www.bigmountainstudio.com 187
NavigationLink
NavigationController
class NavigationController {
This navigate function returns the view to navigate to .
@ViewBuilder
www.bigmountainstudio.com 188
NavigationLink
iOS 16
Navigation Path
www.bigmountainstudio.com 189
NavigationLink
View 3 var body : some View { Note: The term " root"
}
See next page for how the
.font ( .title )
destination views pop back
} to the root (first ) view .
}
www.bigmountainstudio.com 190
NavigationLink
www.bigmountainstudio.com 191
NavigationLink
www.bigmountainstudio.com 192
iOS 14
OutlineGroup
ii
!
OutlineGroups gives you another way to present hierarchical data . It is very similar to using a List with the children parameter. Except this
container view does not scroll . It's probably best for limited data .
www.bigmountainstudio.com 193
OutlineGroup
((
3:34 var parents = [ Parent ( name : " Mark " ,
children : [ Parent ( name : " Paola " ) ] ) ,
Parent ( name : " Rodrigo " ,
OutlineGroup children : [ Parent ( name : " Kai " ) ,
Parent ( name : " Brennan " ) ,
Introduction Parent ( name : " Easton " ) ] ) ,
Parent ( name : " Marcella " ,
This is very similar to using children : [ Parent ( name : " Sam " ,
children : [ Parent ( name : " Joe " ) ] ) ,
the List with the children
Parent ( name : " Melissa " ) ,
parameter except this Parent ( name : " Melanie " ) ] ) ]
container does not scroll . var body : some View {
VStack ( spacing : 20.0 ) {
HeaderView ( " OutlineGroup " ,
Mark subtitle : " Introduction " ,
Paola desc : " This is very similar to using the List with the children parameter
except this container does not scroll . " ,
back : Color.red , textColor : .primary )
Rodrigo
>
www.bigmountainstudio.com 194
OutlineGroup
?!! iOS 14
www.bigmountainstudio.com 195
iOS 14
OutlineGro
up
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
This is a pull - in view.
www.bigmountainstudio.com 196
Picker
To get or set a value for the Picker, you need to bind it to a variable . This variable is then passed into the Picker's initializer .
Then , all you need to do is change this bound variable's value to select the row you want to show in the Picker . Or read the
bound variable's value to see which row is currently selected . One thing to note is that this variable is actually bound to the
Picker row's tag property which you will see in the following pages .
www.bigmountainstudio.com 197
Picker
Introduction
I
struct Picker_Intro : View {
3:01 Starting in iOS 15, the default picker
@State private var favoriteState = 1
style will look like the menu style .
Picker
(Before, the default was the wheel
var body : some View {
Introduction style . )
VStack ( spacing : 20 ) { iOS 15
HeaderView( " Picker " ,
You can associate a property
subtitle : " Introduction " ,
with the picker rows ' tag
values . desc : " You can associate a property with the picker rows ' tag values . " )
Spacer ()
}
.font ( .title )
}
}
www.bigmountainstudio.com 198
Picker
Sections
Ш
struct Picker_Sections : View {
3:56 @State private var favoriteState = 1
Picker
var body : some View {
Sections VStack ( spacing : 20 ) {
HeaderView ( " Picker " ,
subtitle : " Sections " ,
Use sections within your
desc : " Use sections within your picker values to organize selections . " )
picker values to organize
selections. Picker ( " States " , selection : $ favoriteState ) {
Section {
Utah Text ( " California " ) . tag ( 0 )
Text ( " Utah " ) . tag ( 1 )
West } header : {
Text ( " West " )
California
}
✓ Utah
Section {
East Text ( " Vermont " ) . tag ( 2 )
Vermont Text ( " New Hampshire " ) . tag ( 3 )
} header : {
New Hampshire Text ( " East " )
}
}
Spacer ( )
}
.font ( .title )
}
}
www.bigmountainstudio.com 199
Picker
Wheel Style
Ш
struct Picker_Wheel : View {
3:06 This will be the default value
@State private var yourName = "Mark
selected in the Picker.
You can change the way a Picker ( " Name " , selection : $ yourName ) {
Picker looks by using the Text ( " Paul " ) . tag ( " Paul " )
pickerStyle modifier . Text ( " Chris " ) . tag ( " Chris " )
Text ( " Mark " ) . tag ( " Mark " )
Text ( " Scott " ) . tag ( " Scott " )
Paul Text ( "Meng " ) . tag ( " Meng " )
Chris }
Set the style right on the
Mark .pickerStyle ( .wheel,
Picker.
Scott }
Meng
.font ( .title )
}
}
www.bigmountainstudio.com 200
Picker
Programmatic Selection
Ш
struct Picker_ProgrammaticSelection : View {
3:15 @State private var favoriteState = 1
Programmatic Selection desc : " You can programmatically change the Picker selection just by
changing the bound property . " )
You can programmatically
Picker ( " States " , selection : $ favoriteState ) {
change the Picker selection
Text ( " California " ) . tag ( 0 )
just by changing the bound Text ( " Colorado " ) . tag ( 1 )
property. Text ( " Montana " ) . tag ( 2 )
Text ( " Utah " ) . tag ( 3 )
.font ( .title )
}
}
www.bigmountainstudio.com 201
Picker
Customized
Ш
struct Picker_Customized : View {
3:20 @State private var favoriteState = 1
@State private var youTuberName = "Mark"
Picker
var body : some View {
VStack ( spacing : 16 ) {
With Modifiers
Text ( " Picker " ) . font ( .largeTitle )
Text ( " With Modifiers " ) . foregroundColor ( .gray )
Your Favorite State: Text ( " Your Favorite State : " )
Picker ( " Select State " , selection : $ favoriteState ) {
Text ( " California " ) . tag ( 0 )
Text ( " Utah " ) . tag ( 1 )
Text ( " Vermont " ) . tag ( 2 )
California }
Utah .pickerStyle ( .wheel )
Vermont .padding ( .horizontal )
.background ( RoundedRectangle ( cornerRadius : 20 )
.fill ( Color.blue ) )
.padding ( )
www.bigmountainstudio.com 202
Picker
Ш
struct Picker_RowsWithImages : View {
9:08 @State private var youTuberName = "Mark"
www.bigmountainstudio.com 203
Picker
Ш
struct Picker_BindingToData : View {
9:05 @State private var youTuberName = "Mark"
var youTubers = [ " Sean " , " Chris " , " Mark " , " Scott " , " Paul " ]
Binding to Data Text ( " Who do you want to watch today ? " )
www.bigmountainstudio.com 204
Picker
Pickers in Forms
www.bigmountainstudio.com 205
PhotosPicker
iOS 16
PhotosPicker
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
The photos picker first appear button on your UI . Wher preview. will give the user access to the photos library. You can
programmatically filter what you want them to see, such as just videos or time - lapse videos .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
The photos picker view (the
www.bigmountainstudio.com 206
iOS 14
ProgressView
SWIFTUI
HALSTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
This is a pull- in view in so SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
207
RenameButton
iOS 16
RenameButton
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste VIFTUIDEVELOPERS BigMountainStudio
BigMountainStudio
Mark Moey ke ns Mastery
The rename button doesn't d by itsel This SwiftUl chapter is locked in this er to implement some code when the button
is tapped .
preview.
The button can be formatted just like the SwiftUI Button can .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
This is a pull - in view.
www.bigmountainstudio.com 208
ScrollView
A ScrollView is like a container for child views . When the child views within the ScrollView go outside the frame , the user
can scroll to bring the child views that are outside the frame into view.
A ScrollView is a push - out view in the scroll direction you specify. You can set the direction of a ScrollView to be vertical or
horizontal .
www.bigmountainstudio.com 209
ScrollView
Introduction
)•
" Chase " , " Evans " , " Paul " , " Durtschi " , " Max " ]
Scott
var body : some View { Wrap the ForEach in a ScrollView.
ScrollView
Mark ForEach ( names , id : \ .self ) { name in
HStack {
A Scrollview with a ForEach view is similar to a List . But be warned , the rows are not reusable . It is best
Paul to limit the number of rows for memory and performance considerations.
www.bigmountainstudio.com 210
ScrollView
SafeArealnset iOS 15
((
7:50
@State private var names = [ " Scott " , " Mark " , " Chris " , " Sean " , " Rod " , " Meng " , " Natasha " ,
" Chase " , " Evans " , " Paul " , " Durtschi " , " Max " ]
Scott
var body : some View {
ScrollView {
Mark ForEach ( names , id : \ .self ) { name in
HStack {
Text ( name )
Chris
. foregroundStyle ( .primary)
Image ( systemName : " checkmark.seal.fill " )
Sean . foregroundStyle ( .green )
Spacer ()
}
Rod
.padding ( )
.background ( Color.white.shadow ( .drop ( radius : 1 , y : 1) ) ,
Meng in : RoundedRectangle ( cornerRadius : 8 ) )
}
.padding ( .horizontal ) The rows will scroll behind the safe area inset but
Natasha
} when you get to the bottom , the last row will show
.safeAreaInset ( edge : .bottom ) { completely outside of it .
Chase VStack ( spacing : 20 ) {
Divider ( ) Last row
Max
Text ( " 12 People " )
Evans
}
.background ( .regularMaterial ) 12 People
}
12 People .font ( .title )
}
}
www.bigmountainstudio.com 211
ScrollView
Scroll Horizontally
HStack {
RoundedRectangle ( cornerRadius : 15 )
.fill ( item )
www.bigmountainstudio.com 212
ScrollView
iOS 15
Leading SafeArealnset
•)
Color.yellow , Color.orange ] safeArealnset to a
ScrollView to show
var body : some View {
GeometryReader { gr in additional views that
VStack {
will inset the
Spacer ( )
ScrollView ( Axis.Set.horizontal , showsIndicators : true ) ScrollView's content .
HStack {
ForEach ( items , id : \ .self ) { item in
RoundedRectangle ( cornerRadius : 15 )
.fill ( item )
.frame ( width : gr.size.width —- 60 )
}
}
Scroll }
.padding ( .trailing ) The first item in the ScrollView
■ safeAreaInset ( edge : .leading ) { will be moved just enough to
VStack ( spacing : 10 ) { start next to the safeArealnset
Text ( " Scroll " ) view.
.font ( .body )
Image ( systemName : " arrow.left.circle " ) When you start scrolling , the
} contents of the ScrollView will
.frame ( maxHeight : .infinity )
go below your safeArealnset
.padding ( .horizontal )
view:
.background ( .regularMaterial )
In this example, we set the }
.frame ( height : 200 )
edge to leading . But you
Spacer () Scroll
can also use trailing . }
}
.font ( .title )
}
}
www.bigmountainstudio.com 213
ScrollView
www.bigmountainstudio.com 214
Searchable
iOS 15
Searchable
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
preview.
In iOS , the searchable modifier adds a text field to the NavigationView . Using it without a navigation view will show nothing .
Use this modifier for siturtiene wher the ability to La for
ata or filter an existing
set of data already show SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 215
SecureField
In order to get or set the text in a SecureField , you need to bind it to a variable . This variable is passed into the
SecureField's initializer. Then , all you need to do is change this bound variable's text to change what is in the SecureField .
Or read the bound variable's value to see what text is currently in the SecureField .
www.bigmountainstudio.com 216
SecureField
Introduction
VStack ( spacing : 20 ) {
Image ( " Logo " )
Spacer ( )
Text ( " SecureFields , like TextFields , need to bind to a local variable . " )
SecureFields, like TextFields ,
need to bind to a local variable .
www.bigmountainstudio.com 217
SecureField
Customizations
Text ( " Use a ZStack to put a RoundedRectangle behind a SecureField with a plain textfieldStyle . " )
SecureField
ZStack{
Customization RoundedRectangle ( cornerRadius : 8 )
. foregroundColor ( .purple )
TextField ( " user name " , text : $ userName )
Use a ZStack to put a
. foregroundColor ( Color.white )
RoundedRectangle behind a .padding ( .horizontal )
SecureField with a plain }
textfieldStyle . .frame ( height : 40 )
.padding ( .horizontal )
user name
Text ( " Or overlay the SecureField on top of another view or shape . " )
www.bigmountainstudio.com 218
SecureField
Customization Layers
VStack ( spacing : 20 ) {
Text ( " SecureField " )
font ( .largeTitle )
SecureField Text ( " Customization Layers " )
.font ( .title )
Customization Layers
. foregroundColor ( .gray )
Text ( " You can also add a background to the SecureField . It's all the same idea : adjust the
You can also add a background layers . " )
to the SecureField . It's all the
same idea: adjust the layers .
SecureField ( " password " , text : $ password )
password . foregroundColor ( Color.white )
e a st .frame ( height : 40 )
stao tmheide adju .padding ( .horizontal )
.background (
Capsule ( )
. foregroundColor ( .purple )
word
pass )
.padding ( .horizontal )
www.bigmountainstudio.com 219
SecureField
Keyboard Safe Area iOS 14
VStack(spacing: 20) {
Spacer()
Image("Logo")
Spacer()
HeaderView("SecureField",
subtitle: "Keyboard Safe Area",
desc: "SecureFields will automatically move into view when the keyboard
appears. The keyboard adjusts the bottom safe area so it will not cover views.",
back: .purple, textColor: .white)
www.bigmountainstudio.com 220
Segmented Control ( Picker)
Segmented controls are now Picker controls with a different picker style set . In order to get or set the selected segment ,
you need to bind it to a variable . This variable is passed into the segmented control's ( Picker's) initializer. Then , all you need
to do is change this bound variable's value to change the selected segment . Or read the bound variable's value to see
www.bigmountainstudio.com 221
Segmented Control (Picker)
Introduction
VStack ( spacing : 20 ) {
Text ( " Segmented Control ( Picker ) " ) . font ( .largeTitle )
Text ( " Introduction " )
Segmented Control (Picker)
.font ( .title ) .foregroundColor ( .gray )
Introduction Text ( " Associate the segmented control with an @State variable that will control which
segment is selected . The state variable will match each segment's tag value . " )
www.bigmountainstudio.com 222
Segmented Control (Picker)
No Segment Selected
VStack ( spacing : 20 ) {
Text ( " Segmented Control ( Picker ) " ) . font ( .largeTitle )
Text ( " No Segment Selected " )
Segmented Control ( Picker)
.font ( .title ) .foregroundColor ( .gray )
No Segment Selected Text ( " This segmented control will have nothing selected because the default state variable
does not match any of the segment tag values . " )
Text ( " The red outline will go away once a selection is made . " )
www.bigmountainstudio.com 223
Segmented Control (Picker)
Colors
www.bigmountainstudio.com 224
ShareLink
iOS 16
ShareLink
SWIFTUI
MASTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
SAVE 10 % AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
This is a pull - in view.
www.bigmountainstudio.com 225
iOS 14
SignInWithAppleButton
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $ 49.50!
This is a push - out view .
www.bigmountainstudio.com 226
Slider
When using a Slider view, the default range of values is 0.0 to 1.0 . You bind the Slider to a state variable , usually a number
type , like an Int . But it doesn't have to be a number type . It can be any type that conforms to the Stridable protocol .
( "Stride " means to " take steps in a direction ; usually long steps ". ) A type that conforms to Stridable ( such as an Int ) means it
has values that are continuous and can be stepped through and measured . ( " Step through ", " Stride ", I think you see the
connection now. )
You use the bound variable to set or get the value the Slider's thumb ( circle ) is currently at .
www.bigmountainstudio.com 227
Slider
Introduction
Text ( " Default min value is 0.0 and max value is 1.0 " )
} .font ( .title )
}
}
0:00 LJ
www.bigmountainstudio.com 228
Slider
www.bigmountainstudio.com 229
Slider
Customization
www.bigmountainstudio.com 230
Slider
With Images
www.bigmountainstudio.com 231
Slider
Tint iOS 15
VStack ( spacing : 20 ) {
Slider desc : " Tint can also be used to change the color of the Slider's track . " )
Tint
foregroundColor ( .green )
.tint ( .orange
.padding ( )
.font ( .title )
www.bigmountainstudio.com 232
Stepper
-+
When using a Stepper view, you bind it to a state variable , usually a number. But it doesn't have to be a number type . It can
be any type that conforms to the Stridable protocol . ( " Stride " means to " take steps in a direction ; usually long steps ". ) A
type that conforms to Stridable means it has values that are continuous and can be stepped through and measured . ( " Step
through ", " Stride ", I think you see the connection now. )
You use the bound variable to set or get the value it is currently at .
www.bigmountainstudio.com 233
Stepper
-
+ Introduction
VStack ( spacing : 20 ) {
Text ( " Stepper " )
font ( .largeTitle )
Text ( " Introduction " )
Stepper
.font ( .title ) .foregroundColor ( .gray )
Introduction Text ( " The Stepper can be bound to a variable like this : " )
www.bigmountainstudio.com 234
Stepper
-
+ Label Options
Note: Even though the label/title is not shown , I would still recommend having one because it will still
be used for accessibility purposes .
www.bigmountainstudio.com 235
Stepper
-
+
Range
Stepper
Stepper ( value : $ stars , in : 1 ... 5 ) {
Text ( " Rating " )
Range of Values } .padding ( .horizontal )
HStack {
You can set a range for the ForEach ( 1 ... stars , id : \ .self ) { star in
stepper too . In this example, the Image ( systemName : " star.fill" )
}
range is between one and five. }
.font ( .title )
Rating + . foregroundColor ( .yellow )
}
When the Stepper reaches the range limits, the corresponding plus or minus button will appear as disabled . In
this screenshot, notice the plus button is disabled .
www.bigmountainstudio.com 236
Stepper
-
+ Customization
Text ( " Notice the minus and plus buttons are not affected . The platforms determine how this will
Custom Stepper +
be shown . " )
You can add images too. Stepper ( value : $ contrast , in : 0 ... 100 ) {
// SwiftUI implicitly uses an HStack here
Image ( systemName : " circle.lefthalf.fill" )
D 50/100
+
www.bigmountainstudio.com 237
Stepper
-
+ Colors
Text ( " There is no built - in way to change the color of the stepper that I have found . Instead , I
9:39
had to hide the label and apply a color behind it . " )
HStack {
My Custom Colored Stepper +
Text ( " My Custom Colored Stepper " )
My Custom Colored Stepper Spacer ()
My Custom Colored Stepper + Stepper ( " " , value : $ contrast )
.background ( Color.orange , in : Rounded Rectangle ( cornerRadius :
My Custom Colored Stepper .cornerRadius ( 9 )
My Custom Colored Stepper + .labelsHidden ( ) // Hide the label
}
Using RoundedRectangle:
www.bigmountainstudio.com 238
TabView
The TabView acts like a container for child views within it. These child views are individual screens. It provides tab buttons
(TabItems) that allows the user to switch between these child views.
www.bigmountainstudio.com 239
TabView
Introduction
The TabView view can hold allows navigation to that view . " )
.padding ( )
multiple views , one for each
tab. Image ( " TabItem " )
www.bigmountainstudio.com 240
TabView
Tabltems
www.bigmountainstudio.com 241
TabView
TabView {
10:05 Text ( " Call Screen " ) . tabItem {
Image ( systemName : " phone " )
More Edit
Text ( " Call " )
History }
Text ( " Outgoing Phone Calls Screen " ) . tabItem {
New Image ( systemName : " phone.arrow.up.right " )
Text ( " Outgoing " )
}
Text ( " Incoming Phone Calls Screen " ) . tabItem {
Image ( systemName : " phone.arrow.down.left " )
Text ( " Incoming " )
}
Text ( " Phone Book Screen " ) . tabItem {
Image ( systemName : " book " )
Text ( " Phone Book" )
Additional tab
buttons show here . Text ( " History Screen " ) . tabItem {
Image ( systemName : " clock " )
Text ( " History" )
}
Text ( " New Phone Number " ) . tabItem {
Image ( systemName : " phone.badge.plus " )
Text ( " New " )
}
}
A When there are too many tabs to fit for the device , the More button is created where you can find
Call Outgoing Incoming Phone Book More the rest of the tabs listed out .
www.bigmountainstudio.com 242
TabView
Navigation
www.bigmountainstudio.com 243
TabView
Colors
www.bigmountainstudio.com 244
TabView
iOS 15
Symbol Variations
www.bigmountainstudio.com 245
TabView
iOS 15
Badge
}
TabView .tabItem {
Image ( systemName : " house " )
Badge
Text ( " Home " )
}
Use the badge modifier to
// Tab 2
add a number to the tab item .
VStack {
Text ( " Messages " )
}
.tabItem {
Image ( systemName : " envelope " )
Text ( " Messages " )
} Note : The operating system will set
.badge ( 15 ) the color of the badge .
www.bigmountainstudio.com 246
TabView
iOS 15
Background
VStack {
Text ( " Messages " )
Spacer ( )
Divider ( ) Using this modifier allows you to
.background ( Color.brown.opacity ( 0 . provide different backgrounds
} per tab view if you wanted .
.tabItem {
Image ( systemName : " envelope " )
Text ( " Messages " )
}
}
font ( .title )
}
Home Messages } Home Messages
www.bigmountainstudio.com 247
TabView
www.bigmountainstudio.com 248
TabView
UITabBarAppearance iOS 15
www.bigmountainstudio.com 249
iOS 14
SWIFTUI
HALSTERY Visual ReferenceGuide
VIEWS
VISUALTIME-SAVINGREFERENCE
ry SwiftUl Views ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50!
This is a push - out view .
www.bigmountainstudio.com 250
Text
Text
The text view will probably be one of your most - used views . It has many, if not the most , modifiers available to it .
www.bigmountainstudio.com 251
Text
VStack ( spacing : 20 ) {
6:19 Text ( " Text " )
font ( .largeTitle )
Line Limit
Text ( " The Text view shows read - only text that can be modified in many ways . It wraps
automatically . If you want to limit the text wrapping , add .lineLimit ( < number of lines here > ) . " )
www.bigmountainstudio.com 252
Text
www.bigmountainstudio.com 253
Text
Text Text
Weights
www.bigmountainstudio.com 254
Text
Text Text
Weight & Text Style Combined
HeaderView ( " Text " , subtitle : " Weight & Text Styles " ,
Text
desc : " These weights can be combined with Text Styles . " ,
Weight & Text Styles back : green , textColor : white )
.font ( .title )
These weights can be combined
Text ( " Ultralight - Title " )
with Text Styles.
.fontWeight ( .ultraLight )
.font ( .title )
Ultralight - Title Text ( " Thin - Body" )
Thin - Body .fontWeight ( .thin )
.font ( .body ) Note: Instead of two modifiers , you
—
Light Large Title Text ( " Light - Large Title " ) can combine text style and weight in
Bold - Callout fontWeight ( .light ) just ONE modifier like this .
.font ( .largeTitle )
Black - Title Text ( " Bold - Callout " )
· fontWeight ( .bold )
.font ( .callout )
Text ( " Black - Title " )
.font ( Font.title.weight ( .black )
}
}
}
www.bigmountainstudio.com 255
Text
Text Text
Font Design
A " serif" is a little piece that DescView ( desc : " A \ " serif\ " is a little piece that comes off the letter . " ,
comes off the letter.
back : .green , textColor : .white )
www.bigmountainstudio.com 256
Text
Text Text
Formatting
www.bigmountainstudio.com 257
Text
VStack ( spacing : 20 ) {
7:14
Text ( " You might want to tighten up some text that might be too long . " )
Text
Text ( " In the example below , the green has .allowTightening ( true ) " )
Allows Tightening
Tight
Group {
Text ( " Allows tightening to allow text to fit in one line . " )
You might want to tighten up . foregroundColor ( .red )
some text that might be too .allows Tightening ( false )
long. .padding ( .horizontal )
.lineLimit ( 1 )
In the example below, the green Text ( " Allows tightening to allow text to fit in one line . " )
has.allowTightening (true) : . foregroundColor ( .green )
.allowsTightening ( true )
Allows tightening to allow text to fit in one li...
.padding ( .horizontal )
Allows tightening to allow text to fit in one line. .lineLimit ( 1 )
} .padding ( .horizontal )
}
Allows Tightening can be helpful when you see the last word getting truncated . Applying it may not even
fully work depending on just how much space can be tightened . With the default font , I notice I can get
a couple of characters worth of space to tighten up .
www.bigmountainstudio.com 258
Text
((
9:28 var body : some View {
VStack ( spacing : 20 ) {
HeaderView ( " Text " ,
subtitle : " Minimum Scale Factor " ,
desc : " You can shrink text to a minimum percentage of its original font
size with this modifier . " ,
back : .green , textColor : .white )
Text Group {
Text ( " This text is set to a minimum scale factor of 0.6 . " )
Minimum Scale Factor .lineLimit ( 1 )
.minimumScaleFactor ( 0.6 )
You can shrink text to a Text ( " This text is set to a minimum scale factor of 0.7 . " )
.lineLimit ( 1 )
minimum percentage of its
.minimumScaleFactor ( 0.7 )
original font size with this Text ( " This text is set to a minimum scale factor of 0.8 . " )
modifier. .lineLimit ( 1 )
.minimumScaleFactor ( 0.8 )
This text is set to a minimum scale factor of 0.6. Text ( " This text is set to a minimum scale factor of 0.9 . " )
.lineLimit ( 1 )
This text is set to a... m scale factor of 0.7. .minimumScaleFactor ( 0.9 )
}
This text is set to ...scale factor of 0.8. .truncationMode ( .middle )
.padding ( .horizontal )
This text is set ...ale factor of 0.9. }
.font ( .title )
}
}
.minimumScaleFactor takes a fraction from 0 to 1. For example , 0.3 is 30% of the original size of the font
that it can shrink . If the font size is 100, then it can shrink to 30.
www.bigmountainstudio.com 259
Text
Text Text
Line Spacing
VStack ( spacing : 10 ) {
7:25 Text ( " Text " ) . font ( .largeTitle )
Text ( " Line Spacing " ) . font ( .title ) .foregroundColor ( .gray )
Text
Image ( " LineSpacing " )
Line Spacing
Text ( " You can use line spacing to add more space between lines of text . This text has no
line spacing applied : " )
.font ( .title )
You can use line spacing to add .frame ( maxWidth : .infinity )
more space between lines of .padding ( )
text . This text has no line .background ( Color.green )
spacing applied : . foregroundColor ( Color.white )
SwiftUl offers a Line Spacing Text ( " SwiftUI offers a Line Spacing modifier for situations where you want to increase the
modifier for situations where you space between the lines of text on the screen . " )
want to increase the space .font ( .title )
www.bigmountainstudio.com 260
Text
Text Text
Alignment
VStack ( spacing : 20 ) {
7:29 Text ( " Text " ) . font ( .largeTitle )
Text ( " Multiline Text Alignment " ) . foregroundColor ( .gray )
Text Image ( " MultilineTextAlignment " )
Text ( " By default , text will be centered within the screen . But when it wraps to multiple
Multiline Text Alignment
lines , it will be leading aligned by default . Use multilineTextAlignment modifier to change
this ! " )
www.bigmountainstudio.com 261
Text
VStack ( spacing : 20 ) {
11:06 Text ( " Text " ) . font ( .largeTitle )
Text ( " Truncation Mode " ) . font ( .title ) .foregroundColor ( .gray )
Image ( " TruncationMode " )
Text ( " When text gets truncated , you can control where the ellipsis ( ... ) shows . " )
Text
.frame ( maxWidth : .infinity ) .padding ( )
. foregroundColor ( .white ) .background ( Color.green )
Truncation Mode
.font ( .title )
Text ( " Default : .truncationMode ( .tail ) " )
frame ( maxWidth : .infinity ) .padding ( )
. foregroundColor ( .white ) .background ( Color.green )
When text gets truncated , you .font ( .title )
can control where the ellipsis // Text automatically defaults at end
Text ( " This will be the best day of your life ! " )
(...) shows.
· padding ( .horizontal )
· lineLimit ( 1 )
Text ( " . truncationMode ( .middle ) " )
Default: .truncationMode ( .tail)
.frame ( maxWidth : .infinity ) .padding ( )
. foregroundColor ( .white ) .background ( Color.green )
This will be the best day of yo ... Text ( " This will be the best day of your life ! " )
.truncationMode ( .middle ) // Truncate in middle
.truncationMode ( .middle) .padding ( .horizontal )
.lineLimit ( 1 )
Text ( " . truncationMode ( .head ) " )
This will be the...day of your life! .frame ( maxWidth : .infinity ) .padding ( )
foregroundColor ( .white ) .background ( Color.green )
.truncationMode ( .head) Text ( " This will be the best day of your life ! " )
.truncationMode ( .head ) // Truncate at beginning
.padding ( .horizontal )
...ill be the best day of your life ! lineLimit ( 1 )
}
.font ( .title )
www.bigmountainstudio.com 262
Text
Text Text
Combining Modified Text
Group {
7:45 Text ( " You can " )
+ Text ( " format " ) . bold ( )
+ Text ( " different parts of your text by using the plus ( + ) symbol . " )
}
Text Group {
Text ( " Here is another " )
Combining Text Views + Text ( " example " ) . foregroundColor ( .red ) .underline ( )
+ Text ( " of how you might accomplish this . " )
Text + Text + Text ( " Notice " ) . foregroundColor ( .purple ) .bold ( )
+ Text ( " the use of the Group view to add padding and line limit to all the text " )
+ Text ( " as a whole . " ) . bold ( ) . italic ( )
You can format different parts
}
of your text by using the plus .font ( .title )
( + ) symbol . .padding ( .horizontal )
view to add padding and line + Text ( " different font weights " ) .fontWeight ( .black )
limit to all the text as a whole. + Text ( " and different text styles ! " ) . font ( .title ) .fontWeight ( .ultraLight )
}
You can also combine different font .padding ( .horizontal )
Although you see I'm wrapping my Text views in a Group , it is not required . I only do this so I can apply common
modifiers to everything within the Group . See section on the Group view for more information .
www.bigmountainstudio.com 263
Text
www.bigmountainstudio.com 264
Text
Text Text
Layout Priority
Text ( " This text gets truncated first because it has no priority . " )
.font ( .title )
This text gets truncated first b ... . foregroundColor ( .white )
.frame ( maxWidth : .infinity )
.padding ( )
The text view above got
.background ( Color.pink )
truncated because its layout
priority is zero (the default) . Text ( " The text view above got truncated because its layout priority is zero ( the default ) . This
This text view has a priority of 1 . text view has a priority of 1. The text view on top has a priority of 2. " )
.font ( .title )
The text view on top has a
. foregroundColor ( .white )
priority of 2 . .frame ( maxWidth : .infinity )
.padding ( )
.background ( Color.green )
.layoutPriority ( 1 ) // Next highest priority
www.bigmountainstudio.com 265
Text
www.bigmountainstudio.com 266
Text
Text Text
Imported Fonts
Text Text ( " Use the Font.custom ( ) function to set imported fonts you added to your
project . " )
Imported Fonts ---
In order for this to work , you have to add the font file to your project and be sure to have the font file
target your project . Then you need to add the font file name to the Info.plist under the " Fonts provided
by application " key :
www.bigmountainstudio.com 267
Text
SWIFTUI
12:53 @ScaledMetric private var fontSize : CGFloat = 40 12:53
Visual ReferenceGuide
me View
9: VISUAL TIME-SAVING REFERENCE
Swif Text
tUl Views w ("!
de
SwiftUl Views
ba RelativeTo
Text
VIEWS
Lo ,
RelativeTo (.cu
You can
VISUALTIME-SAVING REFERENCE
You can control how custom SwiftUl Views ry
y control how ...
Master tain io VIFTUI DEVELOPERS Big Mountain Studio
or imported fonts scale by BigMoun Stud
using the relat ns
MarkMoeyke ont ( .title ) Mastery
parameter.
Hello, World !
Hell
This SwiftUl content is locked in this preview.
Unlock over 20 more pages of what you can do with the Text Hello
SAVE 10 % AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50 !
www.bigmountainstudio.com 268
iOS 14
TextEditor
SWIFTUI
MASTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swift
Ul Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
ry
Maste g untain dio VIFTUIDEVELOPERS BigMountainStudio
Bi Mo Stu
Mark Moeykens Mastery
OD
preview.
You can use the TextEditor to provide text input from users that goes beyond just one line .
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $ 55 $ 49.50!
This is a push - out view .
www.bigmountainstudio.com 269
TextField
Text
In order to get or set the text in a TextField , you need to bind it to a variable . This variable is passed into the TextField's
initializer. Then , all you need to do is change this bound variable's text to change what is in the TextField . Or read the bound
www.bigmountainstudio.com 270
TextField
Text Text
Introduction
((
1:33 ||||
@State private var textFieldData =
www.bigmountainstudio.com 271
TextField
Text Text
Title ( Placeholder or Hint Text)
You can supply title text Text ( " You can supply title text ( placeholder / hint text ) through the first parameter
to let the user know the purpose of the text field . " )
(placeholder/hint text) through .frame ( maxWidth : .infinity ) .padding ( )
the first parameter to let the .background ( Color.orange )
user know the purpose of the
text field . Group {
TextField ( " Here is title text " , text : $ textFieldData )
textFieldStyle ( .roundedBorder )
Here is title text
www.bigmountainstudio.com 272
TextField
Text Text
Text Alignment
www.bigmountainstudio.com 273
TextField
Text Text
Text Size and Fonts
www.bigmountainstudio.com 274
TextField
Text Text
Customizing Colors
www.bigmountainstudio.com 275
TextField
((
3:21 @State private var textFieldData =
Border Group {
TextField ( " Data " , text : $ textFieldData )
Use the border modifier to .padding ( 5 )
.border ( Color.orange )
apply a ShapeStyle to the
border of the text field . TextField ( " Data " , text : $ textFieldData ) iOS 15
.padding ( 5 )
.border ( .ultraThickMaterial , width : Material ShapeStyles
Data
are available in iOS 15.
TextField ( " Data " , text : $ textFieldData )
Data .padding ( 5 )
.border ( .tertiary , width : 5 )
www.bigmountainstudio.com 276
TextField
Text Text
Custom Placeholder/ Hint Text
// Second TextField
ZStack ( alignment : .leading ) {
if textFieldData.isEmpty {
Text ( " Email Address " ) . italic ( )
www.bigmountainstudio.com 277
TextField
Text Text
Custom Placeholder/Hint Text Continued
.foregroundColor ( .orange )
.opacity (0.4 )
}
TextField ( "' " , text :
$ textFieldData )
}
.padding ( EdgeInsets ( top : 4 , leading : 10 , bottom : 4 , trailing : 10 ) )
.overlay (
RoundedRectangle ( cornerRadius : 8 )
.stroke ( Color.gray , lineWidth : 1 ) )
} .padding ( .horizontal )
} .font ( .title )
}
www.bigmountainstudio.com 278
TextField
Text Text
Custom Composition
www.bigmountainstudio.com 279
TextField
Text
Keyboard Type
TextField
var body : some View {
VStack ( spacing : 20 ) {
Keyboard Types
Text ( " TextField " )
font ( .largeTitle )
Text ( " Keyboard Types " )
.foregroundColor ( .gray )
Control which keyboard is
shown with the keyboardType Image ( " KeyboardType " )
modifier.
Text ( " Control which keyboard is shown with the keyboardType modifier . " )
Enter Phone Number .frame ( maxWidth : .infinity )
.padding ( )
.background ( Color.orange )
1 3
ABC DEF
4 6 Spacer ( )
GHI JKL MNO } .font ( .title )
000
7 8 9 }
PQRS TUV WXYZ
}
+* #
www.bigmountainstudio.com 280
TextField
www.bigmountainstudio.com 281
TextField
.phonePad
www.bigmountainstudio.com 282
TextField
Autocorrection Disabled
struct TextField_Autocorrection: View {
You may have noticed that space above some of the
@State private var lastName = ""
keyboard types that offer autocorrection. You can
@State private var code = "" turn this off with the autocorrectDisabled modifier.
VStack(spacing: 10) {
.textFieldStyle(.roundedBorder)
.padding(.horizontal)
.textFieldStyle(.roundedBorder)
.padding(.horizontal)
.font(.title)
www.bigmountainstudio.com 283
TextField
Text
Disable TextFields о
Group {
TextField ( " Enter Last Name " , text : $ lastName )
TextField ( " Enter City " , text : $ city )
}
.disableAutocorrection ( true )
.textFieldStyle ( .roundedBorder )
.padding ( .horizontal )
.disabled ( disabled ) // Don't allow to edit when disabled
.opacity ( disabled ? 0.5 : 1 ) // Fade out when disabled
Spacer ()
} .font ( .title )
}
}
FL
Note : The disabled modifier applies to ANY
VIEW. Not just the TextField view.
www.bigmountainstudio.com 284
TextField
onEditingChanged
struct TextField_OnEditingChanged: View {
@State private var text = ""
@State private var isEditing = false
www.bigmountainstudio.com 285
TextField
iOS 15
Autocapitalization
struct TextField_Autocapitalization: View {
@State private var textFieldData1 = ""
When a user starts typing into a TextField, the
@State private var textFieldData2 = "" first word in each sentence is always
@State private var textFieldData3 = "" capitalized. You can change this behavior with
@State private var textFieldData4 = "" the textInputAutocapitalization modifier.
var body: some View {
VStack(spacing: 50) {
Text("Words")
TextField("First & Last Name", text: $textFieldData1)
.textInputAutocapitalization(.words)
.textFieldStyle(.roundedBorder)
.padding(.horizontal)
Text("Sentences (default)")
TextField("Bio", text: $textFieldData2)
.textInputAutocapitalization(.sentences)
.textFieldStyle(.roundedBorder)
.padding(.horizontal)
Text("Never")
TextField("Web Address", text: $textFieldData3)
.textFieldStyle(.roundedBorder)
.textInputAutocapitalization(.never)
.padding(.horizontal)
Text("Characters")
TextField("Country Code", text: $textFieldData4)
.textInputAutocapitalization(.characters)
.textFieldStyle(.roundedBorder)
.padding(.horizontal)
}
}
}
www.bigmountainstudio.com 286
TextField
SWIFTUI
1111
@State private var userName =
Visual Reference Guide
te private Varnas
ge ("
er (
VIEWS
derv
VISUALTIME-SAVING REFERENCE
SwiftUl Views ry
y move into view when the keyboard
Master VIFTUI DEVELOPERS
BigMountainStudio Big Mountain Studio area so it will not cover views . "
ns
MarkMoeyke Mastery
font ( .title )
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $ 49.50 !
www.bigmountainstudio.com 287
Toggle
The Toggle is a switch that can either be on or off . Much like other controls , you need to bind it to a variable . This variable is
passed into the Toggle's initializer. Then , all you need to do is change this bound variable's value to change the Toggle's
state on or off. Or read the bound variable's value to see what state the Toggle is currently in .
www.bigmountainstudio.com 288
Toggle
Introduction
(C
4:45 @State private var isToggleOn = true
www.bigmountainstudio.com 289
Toggle
(C
4:42 @State private var isToggleOn = true
Color Group {
Toggle ( ison : $ is ToggleOn ) {
Text ( " Red " )
You can change the color of
Image ( systemName : " paintpalette " )
the Toggle through the
SwitchToggleStyle .
.toggleStyle ( SwitchToggleStyle ( tint : Color.red ) )
www.bigmountainstudio.com 290
Toggle
Tint iOS 15
Tint Group {
Toggle ( ison : $ isToggleOn ) {
Text ( " Red " )
Starting in iOS 15 , you can
use the tint modifier to Image ( systemName : " paintpalette " )
www.bigmountainstudio.com 291
Toggle
iOS 15
ToggleStyle
.toggleStyle ( .button )
.toggleStyle ( .button )
Notice when the toggleStyle is button and
}
.font ( .title ) it is in the on state , the whole button
} becomes filled .
}
www.bigmountainstudio.com 292
ADDITIONAL CHAPTERS
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
294
PAINTS
Covered in the SwiftUI Views Mastery book.
Includes: AngularGradient, ImagePaint, LinearGradient and RadialGradient with the many examples
of how they work when applied to different views.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
295
CONTROLS MODIFIER Covered in the SwiftUI Views Mastery book.
Includes: ActionSheet, Alert, ContextMenu, Sheet (Modals), Popover, Custom Popups and the StatusBar
Hidden modifier with the many examples of how they work when used with different views.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
www.bigmountainstudio.com 296
LAYOUT MODIFIERS Covered in the SwiftUI Views Mastery book.
Includes: AspectRatio, Background, EdgesIgnoringSafeArea, FixedSize, Frame, Hidden,
LayoutPriority, Offset, Overlay, Padding, Position, ScaleToFill, ScaleToFit, and zIndex with the many
examples of how they work when used with different views and modifiers.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
297
EFFECT MODIFIERS Covered in the SwiftUI Views Mastery book.
Includes: AccentColor, BlendMode, Blur, Border, Brightness, Clipped, ClipShape, ColorInvert,
ColorMultiply, ColorScheme, CompositingGroup, ContentShape, Contrast, CornerRadius,
DrawingGroup, ForegroundColor, Grayscale, HueRotation, LuminanceToAlpha, Mask, Opacity,
PreferredColorScheme, RotationEffect, Rotation3DEffect, Saturation, ScaleEffect, Shadow, and
TransformEffect with the many examples of how they work.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
298
CUSTOM STYLING Covered in the SwiftUI Views Mastery book.
Includes: ButtonStyle, DatePickerStyle, ListStyle, NavigationViewStyle, PickerStyle, TextFieldStyle,
ToggleStyle, Global Styling, View Modifiers and Styling Shapes with the many examples of how
they work when used.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
299
IMAGE MODIFIERS Covered in the SwiftUI Views Mastery book.
Includes: Interpolation, RenderingMode, Resizable, and Symbol ImageScale with the many
examples of how they work.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
300
GESTURES
Covered in the SwiftUI Views Mastery book.
Includes: Drag Gesture, On Long Press Gesture, Magnification Gesture, Rotation Gesture, On Tap
Gesture, Exclusive Gesture, Simultaneous Gesture, Sequence Gesture and High Priority Gesture
with the examples of how they work when applied to different views.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
301
OTHER MODIFIERS Covered in the SwiftUI Views Mastery book.
These are new modifiers that SwiftUI introduced after iOS 13. They include: AllowsHitTesting,
Disabled, Preference and Redacted.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
302
IMPORTING VIEWS
Covered in the SwiftUI Views Mastery book.
Includes how to use the new views that came with the release of iOS 14:
VideoPlayer view in the AVKit and Map view in the MapKit.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
303
ACCESSIBILITY
Covered in the SwiftUI Views Mastery book.
Learn how to include accessibility to enable things like voice over and guidance to the disabled.
SAVE 10% AND UNLOCK THE BOOK TODAY FOR ONLY $55 $49.50!
304
THE END
BIG MOUNTAIN
Studio
www.bigmountainstudio.com 305
Author
༡
Moe
Mar yke
Hi . I'm k ns
I'm a full - time mobile developer with over three decades of programming experience . I have created desktop ,
web and mobile apps in many fields including insurance , banking , transportation , health , and sales . I have also
given talks on programming and enjoy breaking down complex subjects into simple parts to teach in a practical
and useful manner.
@BigMtnStudio @BigMtnStudio
Stay up-to-date on what I'm learning and working on. These arethe Ο Do you prefer hanging out in Instagram? Then follow and get bite-
most real-time updates you will find. sized chunks ofdev info.
306
MORE FROM ME
I have some products you might also be interested in!
BMS_10
Because you got this book you get an introductory discount of 10% off everything in the store . This is to encourage you to continue your
SwiftUl journey and keep getting better at your craft . Enter the code above on checkout or click the button below.
ACTIVATE DISCOUNT
(Note: You should have gotten an email with this coupon code too . Make sure you opt - in for even better discounts through sales in the
future . Go here for instructions on how to do this. )
308
More From Me
DATA IN SWIFTUI DOESN'T HAVE TO BE CONFUSING . YOU WILL MAKE MISTAKES . BUT YOU DON'T HAVE TO WITH THIS BOOK.
C
XCODE
www.bigmountainstudio.com 309
More From Me
SWIFTUI
MASTERY Visual ReferenceGuide
VISUAL TIME-SAVING REFERENCE
Swif
tUl Views
SwiftUl Views
VIEWS
VISUALTIME-SAVINGREFERENCE
SwiftUl Views ry
Mastery VIFTUI DEVELOPERS BigMountainStudio
BigMountainStudio
r k
Ma Mo e y k e n s
Mastery
Over 1,000 pages of SwiftUI Find out how to implement action sheets , modals, popovers
Over 700 screenshots/videos showing you what you can do and custom popups
so you can quickly come back and reference the code Master all the layout modifiers including background and
Learn all the ways to work with and modify images overlay layers, scaling , offsets padding and positioning
See the many ways you can use color as views How do you hide the status bar in SwiftUI? Find out !
Discover the different gradients and how you can apply them This is just the tip of the mountain!
www.bigmountainstudio.com 310
More From Me
DO YOU LIKE ANIMATIONS? WOULD YOU LIKE TO SEE HUNDREDS OF VIDEO ANIMATION EXAMPLES WITH THE CODE?
SWIFTUI
SwiftUI made animations super easy... except when it isn't . Most new
VISUAL Visual ReferenceGuide SwiftUl developers can get a simple animation working but as soon
as they want to customize it , they get lost and waste more time than
Swif VISUAL TIME-SAVING REFERENCE
tUl they should trying to get it working . This book will help you with that
ANIMATIONS
Anim ns
atio SwiftUI Animatio struggle .
ns
Learn all the animation types and options with embedded video
samples and code
Master spring animations
Master transitions for views that are inserted and removed from
VISUAL TIMESAVING REFERENCE
the screen
SwiftUl Animations
y ry
Master Learn how matched GeometryReader should really work
BigMounta ALTEXTBOOK Big Mountain Studio ✓ Customize animations with speeds , delays , and durations
ns Mastery
Mark Moeyke
www.bigmountainstudio.com 311
More From Me
QUICKLY LEARN APPLE'S NEW SWIFTDATA FRAMEWORK VISUALLY SO YOU CAN SAVE TIME BUILDING APP FEATURES .
SWIFTDATA
www.bigmountainstudio.com 312
More From Me
QUICKLY LEARN APPLE'S CORE DATA FRAMEWORK VISUALLY SO YOU CAN SAVE TIME BUILDING APP FEATURES .
Over 500 pages - The largest Core Data book for SwiftUI
CORE
VSAL PICT R
URE BOOK EFERENCE What are the 4 main concepts that will help you finally
DATA
Mas Core Data Mastery How can you use mock data in Core Data and preview it
ter
y while developing your UI?
MASTERY
How can you make your life much easier when using Core
Data and SwiftUI?
How can you not only get data , but also sort , filter, and
VISUAL TIME-SAVING REFERENCE
animate with a fetch request?
Core Data Mastery UI
tl
in Swif ✔ What can you do if you want to group your data into
LOPERS Big Mountain Studio sections?
ns
Mark Moeyke in SwiftUI How can you use the managed object context to insert ,
Mark AREFERENCEGUIDEFOR SWIFTUEDEVELOPERS BigMountainStude
update , and delete data?
Much, much more . Click the link to see.
www.bigmountainstudio.com 313
More From Me
HAVE YOU TRIED TO LEARN COMBINE AND FAILED LIKE I DID ... MULTIPLE TIMES?
COMBINE
ETE C
THE OMPLETEXCODE PROJECT
COMPL
CE
VISUAL TIME -SAVING REFEREN I finally figured out the secret to understanding Combine after 2
Com
bin years and now I'm able to share it with you in this visual , game-
e
changing reference guide .
Mas
ter
Combine Mastery
y How can you architect your apps to work with Combine?
MASTERY
s
Mark Moeyken 12 lines of code...which includes error handling .
www.bigmountainstudio.com 314
THANK YOU
I hope you have enjoyed this book If you find anything wrong or have Found a way to create a cool UI ? I'd
as your visual quick start reference suggestions for improvement, be super interested to see it !
guide . please let me know.
If you would like to write a positive
A lot of time and work went into this Email : review on how this book has helped
to make it as easy as possible for [email protected] you, I would love to hear that too !
you to use .
Direct Message me on Twitter:
@bigmtnstudio
www.bigmountainstudio.com 315
PARTNERING INFO
IT’S FREE TO PARTNER UP AND MAKE MONEY. JUST FOLLOW THESE 2-STEPS:
www.bigmountainstudio.com 316
SHARE THE LOVE
If you like this book and find it useful , I encourage you to share links to my products . I'll give you some effective sharing
tips on the next page . Here are some tips on what you can and cannot share .
Share a screenshot of a page from the free book sample with Share the entire book, whether it's the free sample or paid
your followers and friends along with a link on where they can version .
get the free or paid book . ( https://www.bigmountainstudio.com )
Sell or resell my products .
Share favorable comments and goodwill with others . You helped
make the Swift international community super friendly. Let's Connect myself or my products with sites that promote general
keep it that way. hate , cyber- bullying , or discrimination of any kind .
www.bigmountainstudio.com 317
SHARING TIPS
If you have never been an affiliate before and want some tips to effectively share my products then read on !
Be honest and genuine with your comments . People can tell Be pushy or overly aggressive .
when you're not genuine . • Make people feel wrong or stupid for not buying a product .
• Be deceptive in any way.
Be specific in your comments . Tell us exactly what you liked ,
what you learned or what helped you . Endlessly promote . Mix it in with your other content .
• Share screenshots , gifs or video of your work! •
Think you'll make money by sharing one time . You should
Help others with what you learned . Add value . casually share regularly. Try with once a week, for example .
• Be open that you are sharing an affiliate link.
Share more than one time .
www.bigmountainstudio.com 318