Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions examples/ios/Examples/RealmApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,17 @@ class RealmAppTest: XCTestCase {
let configuration = AppConfiguration(baseURL: "http://localhost:80")
let edgeApp = App(id: EDGE_SERVER_APP_ID, configuration: configuration)

// You can check the `baseURL` of an app to define app logic.
if edgeApp.baseURL == "http://localhost:80" {
print("Client app is currently connected to a local Edge Server instance")
}
XCTAssertEqual(edgeApp.baseURL, "http://localhost:80") // :remove:
// ... log in a user and use the app...
// ... some time later...

try await edgeApp.updateBaseUrl(to: "https://services.cloud.mongodb.com")
// :snippet-end:
XCTAssertEqual(edgeApp.baseURL, "https://services.cloud.mongodb.com")
let user = try await edgeApp.login(credentials: Credentials.anonymous)
XCTAssertNotNil(user)
XCTAssert(user.isLoggedIn)
Expand Down
4 changes: 2 additions & 2 deletions examples/ios/RealmExamples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1499,8 +1499,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/realm/realm-swift.git";
requirement = {
kind = exactVersion;
version = 10.49.3;
kind = upToNextMajorVersion;
minimumVersion = 10.50.1;
};
};
917CA79427ECADC200F9BDDC /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Specify a baseURL to connect to a server other than the default.
// In this case, an Edge Server instance running on the device.
let configuration = AppConfiguration(baseURL: "http://localhost:80")
let app = App(id: YOUR_APP_SERVICES_APP_ID, configuration: configuration)
let edgeApp = App(id: EDGE_SERVER_APP_ID, configuration: configuration)

// You can check the `baseURL` of an app to define app logic.
if edgeApp.baseURL == "http://localhost:80" {
print("Client app is currently connected to a local Edge Server instance")
}
// ... log in a user and use the app...
// ... some time later...

try await app.updateBaseUrl(to: "https://services.cloud.mongodb.com")
try await edgeApp.updateBaseUrl(to: "https://services.cloud.mongodb.com")
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// In this case, an Edge Server instance running on the device.
let configuration = AppConfiguration(baseURL: "http://localhost:80")

let app = App(id: EDGE_SERVER_APP_ID, configuration: configuration)
let edgeApp = App(id: EDGE_SERVER_APP_ID, configuration: configuration)