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
fef8136e
Commit
fef8136e
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add IsReadyInfo model
parent
e92895bd
No related branches found
No related tags found
2 merge requests
!130
Update Bindings
,
!102
Release 1.0.0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Sources/XXClient/Models/IsReadyInfo.swift
+26
-0
26 additions, 0 deletions
Sources/XXClient/Models/IsReadyInfo.swift
Tests/XXClientTests/Models/IsReadyInfoTests.swift
+26
-0
26 additions, 0 deletions
Tests/XXClientTests/Models/IsReadyInfoTests.swift
with
52 additions
and
0 deletions
Sources/XXClient/Models/IsReadyInfo.swift
0 → 100644
+
26
−
0
View file @
fef8136e
import
Foundation
public
struct
IsReadyInfo
:
Equatable
{
public
init
(
isReady
:
Bool
,
howClose
:
Double
)
{
self
.
isReady
=
isReady
self
.
howClose
=
howClose
}
public
var
isReady
:
Bool
public
var
howClose
:
Double
}
extension
IsReadyInfo
:
Codable
{
enum
CodingKeys
:
String
,
CodingKey
{
case
isReady
=
"IsReady"
case
howClose
=
"HowClose"
}
public
static
func
decode
(
_
data
:
Data
)
throws
->
Self
{
try
JSONDecoder
()
.
decode
(
Self
.
self
,
from
:
data
)
}
public
func
encode
()
throws
->
Data
{
try
JSONEncoder
()
.
encode
(
self
)
}
}
This diff is collapsed.
Click to expand it.
Tests/XXClientTests/Models/IsReadyInfoTests.swift
0 → 100644
+
26
−
0
View file @
fef8136e
import
CustomDump
import
XCTest
@testable
import
XXClient
final
class
IsReadyInfoTests
:
XCTestCase
{
func
testCoding
()
throws
{
let
jsonString
=
"""
{
"
IsReady
": true,
"
HowClose
": 0.534
}
"""
let
jsonData
=
jsonString
.
data
(
using
:
.
utf8
)
!
let
model
=
try
IsReadyInfo
.
decode
(
jsonData
)
XCTAssertNoDifference
(
model
,
IsReadyInfo
(
isReady
:
true
,
howClose
:
0.534
))
let
encodedModel
=
try
model
.
encode
()
let
decodedModel
=
try
IsReadyInfo
.
decode
(
encodedModel
)
XCTAssertNoDifference
(
decodedModel
,
model
)
}
}
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