Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up gRPC.swift #386

Merged
merged 1 commit into from
Feb 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)!
}
}