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
e8194482
Commit
e8194482
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Use Fact model in ContactFactsProvider
parent
18bc435a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Use codable models in API
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/ElixxirDAppsSDK/ContactFactsProvider.swift
+6
-4
6 additions, 4 deletions
Sources/ElixxirDAppsSDK/ContactFactsProvider.swift
with
6 additions
and
4 deletions
Sources/ElixxirDAppsSDK/ContactFactsProvider.swift
+
6
−
4
View file @
e8194482
import
Bindings
public
struct
ContactFactsProvider
{
public
var
get
:
(
Data
)
throws
->
Data
public
var
get
:
(
Data
)
throws
->
[
Fact
]
public
func
callAsFunction
(
contact
:
Data
)
throws
->
Data
{
public
func
callAsFunction
(
contact
:
Data
)
throws
->
[
Fact
]
{
try
get
(
contact
)
}
}
...
...
@@ -11,13 +11,15 @@ public struct ContactFactsProvider {
extension
ContactFactsProvider
{
public
static
let
live
=
ContactFactsProvider
{
contact
in
var
error
:
NSError
?
let
facts
=
BindingsGetFactsFromContact
(
contact
,
&
error
)
let
facts
Data
=
BindingsGetFactsFromContact
(
contact
,
&
error
)
if
let
error
=
error
{
throw
error
}
guard
let
facts
=
facts
else
{
guard
let
facts
Data
=
facts
Data
else
{
fatalError
(
"BindingsGetFactsFromContact returned `nil` without providing error"
)
}
let
decoder
=
JSONDecoder
()
let
facts
=
try
decoder
.
decode
([
Fact
]
.
self
,
from
:
factsData
)
return
facts
}
}
...
...
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