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
6a540463
Commit
6a540463
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add SetFactsOnContact functor
parent
e1462a9a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!102
Release 1.0.0
,
!18
Update Bindings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/ElixxirDAppsSDK/SetFactsOnContact.swift
+34
-0
34 additions, 0 deletions
Sources/ElixxirDAppsSDK/SetFactsOnContact.swift
with
34 additions
and
0 deletions
Sources/ElixxirDAppsSDK/
Legacy/ContactFactsSetter
.swift
→
Sources/ElixxirDAppsSDK/
SetFactsOnContact
.swift
+
34
−
0
View file @
6a540463
import
Bindings
import
Bindings
import
XCTestDynamicOverlay
public
struct
ContactFactsSetter
{
public
struct
SetFactsOnContact
{
public
var
set
:
(
Data
,
[
Fact
])
throws
->
Data
public
var
run
:
(
Data
,
[
Fact
])
throws
->
Data
public
func
callAsFunction
(
public
func
callAsFunction
(
contact
:
Data
,
contact
:
Data
,
facts
:
[
Fact
]
facts
:
[
Fact
]
)
throws
->
Data
{
)
throws
->
Data
{
try
set
(
contact
,
facts
)
try
run
(
contact
,
facts
)
}
}
}
}
extension
ContactFactsSetter
{
extension
SetFactsOnContact
{
public
static
let
live
=
ContactFactsSetter
{
contact
,
facts
in
public
static
let
live
=
SetFactsOnContact
{
contact
,
facts
in
let
encoder
=
JSONEncoder
()
let
factsData
=
try
facts
.
encode
()
let
factsData
=
try
encoder
.
encode
(
facts
)
var
error
:
NSError
?
var
error
:
NSError
?
let
updatedContact
=
BindingsSetFactsOnContact
(
contact
,
factsData
,
&
error
)
let
updatedContact
=
BindingsSetFactsOnContact
(
contact
,
factsData
,
&
error
)
if
let
error
=
error
{
if
let
error
=
error
{
...
@@ -27,11 +27,8 @@ extension ContactFactsSetter {
...
@@ -27,11 +27,8 @@ extension ContactFactsSetter {
}
}
}
}
#if DEBUG
extension
SetFactsOnContact
{
extension
ContactFactsSetter
{
public
static
let
unimplemented
=
SetFactsOnContact
(
public
static
let
failing
=
ContactFactsSetter
{
_
,
_
in
run
:
XCTUnimplemented
(
"
\(
Self
.
self
)
"
)
struct
NotImplemented
:
Error
{}
)
throw
NotImplemented
()
}
}
}
#endif
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