Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F14171753
AccountView.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
AccountView.swift
View Options
import
SwiftUI
struct
AccountView
:
View
{
@
EnvironmentObject
var
model
:
WriteFreelyModel
@
EnvironmentObject
var
errorHandling
:
ErrorHandling
var
body
:
some
View
{
if
model
.
account
.
isLoggedIn
{
HStack
{
Spacer
()
AccountLogoutView
()
.
withErrorHandling
()
Spacer
()
}
.
padding
()
}
else
{
AccountLoginView
()
.
withErrorHandling
()
.
padding
(.
top
)
}
EmptyView
()
.
onChange
(
of
:
model
.
hasError
)
{
value
in
if
value
{
if
let
error
=
model
.
currentError
{
self
.
errorHandling
.
handle
(
error
:
error
)
}
else
{
self
.
errorHandling
.
handle
(
error
:
AppError
.
genericError
())
}
model
.
hasError
=
false
}
}
}
}
struct
AccountLogin_Previews
:
PreviewProvider
{
static
var
previews
:
some
View
{
AccountView
()
.
environmentObject
(
WriteFreelyModel
())
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Apr 2, 2:31 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3673626
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment