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
79ffc734
Commit
79ffc734
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Fix groups list
parent
8def5f9d
No related branches found
No related tags found
2 merge requests
!153
Release 1.1.0
,
!149
[Messenger example] create new group
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift
+1
-1
1 addition, 1 deletion
.../xx-messenger/Sources/GroupsFeature/GroupsComponent.swift
Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift
+12
-16
12 additions, 16 deletions
Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift
with
13 additions
and
17 deletions
Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift
+
1
−
1
View file @
79ffc734
...
@@ -40,7 +40,7 @@ public struct GroupsComponent: ReducerProtocol {
...
@@ -40,7 +40,7 @@ public struct GroupsComponent: ReducerProtocol {
case
.
start
:
case
.
start
:
return
Effect
return
Effect
.
catching
{
try
db
()
}
.
catching
{
try
db
()
}
.
flatMap
{
$0
.
fetchGroupsPublisher
.
callAsFunction
(
.
init
())
}
.
flatMap
{
$0
.
fetchGroupsPublisher
(
.
init
())
}
.
assertNoFailure
()
.
assertNoFailure
()
.
map
(
Action
.
didFetchGroups
)
.
map
(
Action
.
didFetchGroups
)
.
subscribe
(
on
:
bgQueue
)
.
subscribe
(
on
:
bgQueue
)
...
...
This diff is collapsed.
Click to expand it.
Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift
+
12
−
16
View file @
79ffc734
...
@@ -7,6 +7,7 @@ import XXModels
...
@@ -7,6 +7,7 @@ import XXModels
public
struct
GroupsView
:
View
{
public
struct
GroupsView
:
View
{
public
typealias
Component
=
GroupsComponent
public
typealias
Component
=
GroupsComponent
typealias
ViewStore
=
ComposableArchitecture
.
ViewStore
<
ViewState
,
Component
.
Action
>
public
init
(
store
:
StoreOf
<
Component
>
)
{
public
init
(
store
:
StoreOf
<
Component
>
)
{
self
.
store
=
store
self
.
store
=
store
...
@@ -15,22 +16,20 @@ public struct GroupsView: View {
...
@@ -15,22 +16,20 @@ public struct GroupsView: View {
let
store
:
StoreOf
<
Component
>
let
store
:
StoreOf
<
Component
>
struct
ViewState
:
Equatable
{
struct
ViewState
:
Equatable
{
init
(
state
:
Component
.
State
)
{}
init
(
state
:
Component
.
State
)
{
groups
=
state
.
groups
}
var
groups
:
IdentifiedArrayOf
<
XXModels
.
Group
>
=
[]
var
groups
:
IdentifiedArrayOf
<
XXModels
.
Group
>
}
}
public
var
body
:
some
View
{
public
var
body
:
some
View
{
WithViewStore
(
store
,
observe
:
ViewState
.
init
)
{
viewStore
in
WithViewStore
(
store
,
observe
:
ViewState
.
init
)
{
viewStore
in
Form
{
Form
{
newGroupButton
{
newGroupButton
(
viewStore
)
viewStore
.
send
(
.
newGroupButtonTapped
)
}
ForEach
(
viewStore
.
groups
)
{
group
in
ForEach
(
viewStore
.
groups
)
{
group
in
groupView
(
group
)
{
groupView
(
group
,
viewStore
)
viewStore
.
send
(
.
didSelectGroup
(
group
))
}
}
}
}
}
.
navigationTitle
(
"Groups"
)
.
navigationTitle
(
"Groups"
)
...
@@ -46,10 +45,10 @@ public struct GroupsView: View {
...
@@ -46,10 +45,10 @@ public struct GroupsView: View {
}
}
}
}
func
newGroupButton
(
action
:
@escaping
()
->
Void
)
->
some
View
{
func
newGroupButton
(
_
viewStore
:
ViewStore
)
->
some
View
{
Section
{
Section
{
Button
{
Button
{
action
(
)
viewStore
.
send
(
.
newGroupButtonTapped
)
}
label
:
{
}
label
:
{
HStack
{
HStack
{
Text
(
"New Group"
)
Text
(
"New Group"
)
...
@@ -60,13 +59,10 @@ public struct GroupsView: View {
...
@@ -60,13 +59,10 @@ public struct GroupsView: View {
}
}
}
}
func
groupView
(
func
groupView
(
_
group
:
XXModels
.
Group
,
_
viewStore
:
ViewStore
)
->
some
View
{
_
group
:
XXModels
.
Group
,
onSelect
:
@escaping
()
->
Void
)
->
some
View
{
Section
{
Section
{
Button
{
Button
{
onSelect
(
)
viewStore
.
send
(
.
didSelectGroup
(
group
)
)
}
label
:
{
}
label
:
{
HStack
{
HStack
{
Label
(
group
.
name
,
systemImage
:
"person.3"
)
Label
(
group
.
name
,
systemImage
:
"person.3"
)
...
@@ -75,8 +71,8 @@ public struct GroupsView: View {
...
@@ -75,8 +71,8 @@ public struct GroupsView: View {
Spacer
()
Spacer
()
Image
(
systemName
:
"chevron.forward"
)
Image
(
systemName
:
"chevron.forward"
)
}
}
GroupAuthStatusView
(
group
.
authStatus
)
}
}
GroupAuthStatusView
(
group
.
authStatus
)
}
}
}
}
}
}
...
...
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