Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
Elixxir dApps SDK Swift
Commits
c232f245
Commit
c232f245
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Implement basic error view
parent
632620f4
No related branches found
No related tags found
1 merge request
!1
Client management
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Example/ExampleApp/Sources/ErrorFeature/ErrorFeature.swift
+5
-1
5 additions, 1 deletion
Example/ExampleApp/Sources/ErrorFeature/ErrorFeature.swift
Example/ExampleApp/Sources/ErrorFeature/ErrorView.swift
+24
-3
24 additions, 3 deletions
Example/ExampleApp/Sources/ErrorFeature/ErrorView.swift
with
29 additions
and
4 deletions
Example/ExampleApp/Sources/ErrorFeature/ErrorFeature.swift
+
5
−
1
View file @
c232f245
...
...
@@ -2,7 +2,11 @@ import ComposableArchitecture
import
SwiftUI
public
struct
ErrorState
:
Equatable
{
public
init
()
{}
public
init
(
error
:
NSError
)
{
self
.
error
=
error
}
var
error
:
NSError
}
public
enum
ErrorAction
:
Equatable
{}
...
...
This diff is collapsed.
Click to expand it.
Example/ExampleApp/Sources/ErrorFeature/ErrorView.swift
+
24
−
3
View file @
c232f245
...
...
@@ -7,14 +7,33 @@ public struct ErrorView: View {
}
let
store
:
Store
<
ErrorState
,
ErrorAction
>
@Environment
(\
.
dismiss
)
var
dismiss
struct
ViewState
:
Equatable
{
init
(
state
:
ErrorState
)
{}
let
error
:
NSError
init
(
state
:
ErrorState
)
{
error
=
state
.
error
}
}
public
var
body
:
some
View
{
WithViewStore
(
store
.
scope
(
state
:
ViewState
.
init
))
{
viewStore
in
Text
(
"ErrorView"
)
NavigationView
{
Form
{
Text
(
"
\(
viewStore
.
error
)
"
)
}
.
navigationTitle
(
"Error"
)
.
toolbar
{
ToolbarItem
(
placement
:
.
cancellationAction
)
{
Button
{
dismiss
()
}
label
:
{
Image
(
systemName
:
"xmark"
)
}
}
}
}
}
}
}
...
...
@@ -23,7 +42,9 @@ public struct ErrorView: View {
public
struct
ErrorView_Previews
:
PreviewProvider
{
public
static
var
previews
:
some
View
{
ErrorView
(
store
:
.
init
(
initialState
:
.
init
(),
initialState
:
.
init
(
error
:
NSError
(
domain
:
"preview"
,
code
:
1234
)
),
reducer
:
.
empty
,
environment
:
()
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment