Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F12272701
PreferencesView.swift
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
PreferencesView.swift
View Options
import
SwiftUI
struct
PreferencesView
:
View
{
@
ObservedObject
var
preferences
:
PreferencesModel
var
body
:
some
View
{
VStack
{
VStack
{
Text
(
"Choose the preferred appearance for the app."
)
.
font
(.
caption
)
.
foregroundColor
(.
secondary
)
Picker
(
selection
:
$
preferences
.
appearance
,
label
:
Text
(
"Appearance"
))
{
Text
(
"System"
).
tag
(
0
)
Text
(
"Light"
).
tag
(
1
)
Text
(
"Dark"
).
tag
(
2
)
}
.
pickerStyle
(
SegmentedPickerStyle
())
}
.
padding
(.
bottom
)
VStack
{
Text
(
"Choose the default font for new posts."
)
.
font
(.
caption
)
.
foregroundColor
(.
secondary
)
Picker
(
selection
:
$
preferences
.
font
,
label
:
Text
(
"Default Font"
))
{
Text
(
"Serif"
).
tag
(
0
)
Text
(
"Sans-Serif"
).
tag
(
1
)
Text
(
"Monospace"
).
tag
(
2
)
}
.
pickerStyle
(
SegmentedPickerStyle
())
.
padding
(.
bottom
)
switch
preferences
.
font
{
case
1
:
Text
(
"Sample Text"
)
.
frame
(
width
:
240
,
height
:
50
,
alignment
:
.
center
)
.
font
(.
custom
(
"OpenSans-Regular"
,
size
:
20
))
case
2
:
Text
(
"Sample Text"
)
.
frame
(
width
:
240
,
height
:
50
,
alignment
:
.
center
)
.
font
(.
custom
(
"Hack-Regular"
,
size
:
20
))
default
:
Text
(
"Sample Text"
)
.
frame
(
width
:
240
,
height
:
50
,
alignment
:
.
center
)
.
font
(.
custom
(
"Lora"
,
size
:
20
))
}
}
.
padding
(.
bottom
)
}
}
}
struct
SwiftUIView_Previews
:
PreviewProvider
{
static
var
previews
:
some
View
{
PreferencesView
(
preferences
:
PreferencesModel
())
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Nov 6, 5:27 AM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3468026
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment