Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F14172518
ContentView.swift
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
ContentView.swift
View Options
import
SwiftUI
struct
ContentView
:
View
{
@
EnvironmentObject
var
model
:
WriteFreelyModel
var
body
:
some
View
{
NavigationView
{
SidebarView
()
PostListView
(
selectedCollection
:
nil
,
showAllPosts
:
model
.
account
.
isLoggedIn
)
Text
(
"Select a post, or create a new local draft."
)
.
foregroundColor
(.
secondary
)
}
.
environmentObject
(
model
)
.
alert
(
isPresented
:
$
model
.
isPresentingDeleteAlert
)
{
Alert
(
title
:
Text
(
"Delete Post?"
),
message
:
Text
(
"This action cannot be undone."
),
primaryButton
:
.
destructive
(
Text
(
"Delete"
),
action
:
{
if
let
postToDelete
=
model
.
postToDelete
{
model
.
selectedPost
=
nil
DispatchQueue
.
main
.
async
{
model
.
posts
.
remove
(
postToDelete
)
}
model
.
postToDelete
=
nil
}
}),
secondaryButton
:
.
cancel
()
{
model
.
postToDelete
=
nil
}
)
}
.
alert
(
isPresented
:
$
model
.
isPresentingNetworkErrorAlert
,
content
:
{
Alert
(
title
:
Text
(
"Connection Error"
),
message
:
Text
(
"There is no internet connection at the moment. Please reconnect or try again later"
),
dismissButton
:
.
default
(
Text
(
"OK"
),
action
:
{
model
.
isPresentingNetworkErrorAlert
=
false
})
)
})
#if
os
(
iOS
)
EmptyView
()
.
sheet
(
isPresented
:
$
model
.
isPresentingSettingsView
,
onDismiss
:
{
model
.
isPresentingSettingsView
=
false
},
content
:
{
SettingsView
()
.
environmentObject
(
model
)
}
)
#endif
}
}
struct
ContentView_Previews
:
PreviewProvider
{
static
var
previews
:
some
View
{
let
context
=
LocalStorageManager
.
persistentContainer
.
viewContext
let
model
=
WriteFreelyModel
()
return
ContentView
()
.
environment
(
\
.
managedObjectContext
,
context
)
.
environmentObject
(
model
)
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Apr 2, 3:08 AM (15 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3673534
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment