Skip to content

Commit

Permalink
1.37.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Aug 19, 2022
1 parent 81cf2ca commit 8929c61
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
16 changes: 16 additions & 0 deletions ApiParser/Sources/ApiParser/CodeGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,22 @@ extension CodeGenerator {
result.append("\(tab)public var localizedDescription: String { self.message }\n")
}
}

let customInit: String = """
public init(_ error: Error) {
self.code = 0
self.message = error.localizedDescription
self.data = [:].toAnyValue()
}
public init(_ message: String) {
self.code = 0
self.message = message
self.data = [:].toAnyValue()
}\n\n
"""
result.append(customInit)

result.append("\n\(tab)public init(")
for (index, property) in swiftStruct.properties.enumerated() {
if property.type[#"\?$"#] {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Swift Client for Everscale SDK

[![SPM](https://img.shields.io/badge/swift-package%20manager-green)](https://swift.org/package-manager/)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.36.0-orange)](https://github.com/tonlabs/TON-SDK)
[![SPM](https://img.shields.io/badge/SDK%20VERSION-1.37.0-orange)](https://github.com/tonlabs/TON-SDK)

Swift is a strongly typed language that has long been used not only for iOS development. Apple is actively promoting it to new platforms and today it can be used for almost any task. Thanks to this, this implementation provides the work of Everscale SDK on many platforms at once, including the native one for mobile phones. Let me remind you that swift can also be built for android.

Expand Down
22 changes: 14 additions & 8 deletions Sources/EverscaleClientSwift/Client/ClientTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,24 @@ public struct TSDKClientError: Codable, Error {
public var message: String
public var localizedDescription: String { self.message }
public var data: AnyValue = [:].toAnyValue()

public init(code: UInt32, message: String, data: AnyValue = [:].toAnyValue()) {
self.code = code
self.message = message
self.data = data
}

public init(_ error: Error) {
self.code = 0
self.message = error.localizedDescription
self.data = [:].toAnyValue()
}

public init(_ message: String) {
self.code = 0
self.message = message
self.data = [:].toAnyValue()
}


public init(code: UInt32, message: String, data: AnyValue = [:].toAnyValue()) {
self.code = code
self.message = message
self.data = data
}
}

public struct TSDKClientConfig: Codable {
Expand Down Expand Up @@ -145,7 +151,7 @@ public struct TSDKNetworkConfig: Codable {
/// Must be specified in milliseconds. Default is 5000 (5 sec).
public var next_remp_status_timeout: UInt32?
/// Access key to GraphQL API.
/// At the moment is not used in production.
/// You can specify here Evercloud project secret ot serialized JWT.
public var access_key: String?

public init(server_address: String? = nil, endpoints: [String]? = nil, network_retries_count: Int8? = nil, max_reconnect_timeout: UInt32? = nil, reconnect_timeout: UInt32? = nil, message_retries_count: Int8? = nil, message_processing_timeout: UInt32? = nil, wait_for_timeout: UInt32? = nil, out_of_sync_threshold: UInt32? = nil, sending_endpoint_count: UInt8? = nil, latency_detection_interval: UInt32? = nil, max_latency: UInt32? = nil, query_timeout: UInt32? = nil, queries_protocol: TSDKNetworkQueriesProtocol? = nil, first_remp_status_timeout: UInt32? = nil, next_remp_status_timeout: UInt32? = nil, access_key: String? = nil) {
Expand Down

0 comments on commit 8929c61

Please sign in to comment.