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
6f36b356
Commit
6f36b356
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Fix Contact model methods
parent
23463aaa
No related branches found
No related tags found
2 merge requests
!102
Release 1.0.0
,
!42
Update Bindings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/XXClient/Models/Contact.swift
+33
-22
33 additions, 22 deletions
Sources/XXClient/Models/Contact.swift
with
33 additions
and
22 deletions
Sources/XXClient/Models/Contact.swift
+
33
−
22
View file @
6f36b356
import
Foundation
import
XCTestDynamicOverlay
public
struct
Contact
{
public
init
(
data
:
Data
,
getId
:
@escaping
()
throws
->
Data
,
getPublicKey
:
@escaping
()
throws
->
Data
,
getFacts
:
@escaping
()
throws
->
[
F
act
]
,
setFacts
:
@escaping
(
Data
,
[
Fact
])
throws
->
Data
getId
FromContact
:
GetIdFromContact
,
getPublicKey
FromContact
:
GetPublicKeyFromContact
,
getFacts
FromContact
:
GetFactsFromCont
act
,
setFacts
OnContact
:
SetFactsOnContact
)
{
self
.
data
=
data
self
.
getId
=
getId
self
.
getPublicKey
=
getPublicKey
self
.
getFacts
=
getFacts
self
.
_
setFacts
=
setFacts
self
.
getId
FromContact
=
getIdFromContact
self
.
getPublicKey
FromContact
=
getPublicKey
FromContact
self
.
getFacts
FromContact
=
getFactsFromContact
self
.
setFacts
OnContact
=
setFacts
OnContact
}
public
var
data
:
Data
public
var
getId
:
()
throws
->
Data
public
var
getPublicKey
:
()
throws
->
Data
public
var
getFacts
:
()
throws
->
[
Fact
]
public
var
_setFacts
:
(
Data
,
[
Fact
])
throws
->
Data
public
var
getIdFromContact
:
GetIdFromContact
public
var
getPublicKeyFromContact
:
GetPublicKeyFromContact
public
var
getFactsFromContact
:
GetFactsFromContact
public
var
setFactsOnContact
:
SetFactsOnContact
public
func
getId
()
throws
->
Data
{
try
getIdFromContact
(
data
)
}
public
func
getPublicKey
()
throws
->
Data
{
try
getPublicKeyFromContact
(
data
)
}
public
func
getFacts
()
throws
->
[
Fact
]
{
try
getFactsFromContact
(
data
)
}
public
mutating
func
setFacts
(
_
facts
:
[
Fact
])
throws
{
data
=
try
_
setFacts
(
data
,
facts
)
data
=
try
setFacts
OnContact
(
contactData
:
data
,
facts
:
facts
)
}
}
...
...
@@ -43,10 +54,10 @@ extension Contact {
)
->
Contact
{
Contact
(
data
:
data
,
getId
:
{
try
getIdFromContact
(
data
)
}
,
getPublicKey
:
{
try
getPublicKeyFromContact
(
data
)
}
,
getFacts
:
{
try
getFactsFromContact
(
data
)
}
,
setFacts
:
{
try
setFactsOnContact
(
contactData
:
$0
,
facts
:
$1
)
}
getId
FromContact
:
getIdFromContact
,
getPublicKey
FromContact
:
getPublicKeyFromContact
,
getFacts
FromContact
:
getFactsFromContact
,
setFacts
OnContact
:
setFactsOnContact
)
}
}
...
...
@@ -55,10 +66,10 @@ extension Contact {
public
static
func
unimplemented
(
_
data
:
Data
)
->
Contact
{
Contact
(
data
:
data
,
getId
:
XCTUnimplemented
(
"
\(
Self
.
self
)
.getId"
)
,
getPublicKey
:
XCTUnimplemented
(
"
\(
Self
.
self
)
.getPublicKey"
)
,
getFacts
:
XCTUnimplemented
(
"
\(
Self
.
self
)
.getFacts"
)
,
setFacts
:
XCTUnimplemented
(
"
\(
Self
.
self
)
.updateFacts"
)
getId
FromContact
:
.
unimplemented
,
getPublicKey
FromContact
:
.
unimplemented
,
getFacts
FromContact
:
.
unimplemented
,
setFacts
OnContact
:
.
unimplemented
)
}
}
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