Skip to content

Commit 05116b2

Browse files
committed
[SPARK-51490] Support iOS, watchOS, and tvOS
1 parent 085c3ef commit 05116b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SparkConnect/SparkSession.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ public actor SparkSession {
4545
/// - userID: an optional user ID. If absent, `SPARK_USER` environment or ``ProcessInfo.processInfo.userName`` is used.
4646
init(_ connection: String, _ userID: String? = nil) {
4747
let processInfo = ProcessInfo.processInfo
48+
#if os(iOS) || os(watchOS) || os(tvOS)
49+
let userName = processInfo.environment["SPARK_USER"] ?? ""
50+
#elseif os(macOS) || os(Linux)
4851
let userName = processInfo.environment["SPARK_USER"] ?? processInfo.userName
52+
#else
53+
assert(false, "Unsupported platform")
54+
#endif
4955
self.client = SparkConnectClient(remote: connection, user: userID ?? userName)
5056
self.conf = RuntimeConf(self.client)
5157
}

0 commit comments

Comments
 (0)