Skip to content

Commit

Permalink
Clean up gRPC.swift (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebello95 authored and MrMage committed Feb 28, 2019
1 parent 930440a commit ee0f374
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Sources/SwiftGRPC/Core/gRPC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,30 @@
* limitations under the License.
*/
#if SWIFT_PACKAGE
import CgRPC
import CgRPC
#endif
import Foundation // for String.Encoding

public final class gRPC {
private init() { } // Static members only.

/// Initializes gRPC system
public static func initialize() {
grpc_init()
}

/// Shuts down gRPC system
public static func shutdown() {
grpc_shutdown()
}

/// Returns version of underlying gRPC library
///
/// Returns: gRPC version string
public static var version: String {
// These two should always be valid UTF-8 strings, so we can forcibly unwrap them.
return String(cString: grpc_version_string(), encoding: String.Encoding.utf8)!
return String(cString: grpc_version_string(), encoding: .utf8)!
}

/// Returns name associated with gRPC version
///
/// Returns: gRPC version name
public static var gStandsFor: String {
return String(cString: grpc_g_stands_for(), encoding: String.Encoding.utf8)!
return String(cString: grpc_g_stands_for(), encoding: .utf8)!
}
}

0 comments on commit ee0f374

Please sign in to comment.