-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathCoreAPITests.swift
More file actions
143 lines (113 loc) · 3.35 KB
/
Copy pathCoreAPITests.swift
File metadata and controls
143 lines (113 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// MARK: This file is used to evaluate the experience of using Firebase APIs in Swift.
import Foundation
import FirebaseCore
final class CoreAPITests {
func usage() {
// MARK: - FirebaseApp
// Configure Firebase app
FirebaseApp.configure()
if let options = FirebaseOptions(contentsOfFile: "path/to/GoogleService-Info.plist") {
FirebaseApp.configure(name: "App", options: options)
FirebaseApp.configure(options: options)
}
// Retrieve Firebase app(s)
if let _ /* app */ = FirebaseApp.app() {
// ...
}
if let _ /* app */ = FirebaseApp.app(name: "App") {
// ...
}
if let _ /* apps */ = FirebaseApp.allApps {
// ...
}
// Delete Firebase app
if let app = FirebaseApp.app() {
app.delete { _ /* success */ in
// ...
}
// async/await is a Swift Concurrency feature available on iOS 13+ and macOS 10.15+
Task {
await app.delete()
}
}
// Properties
if let app = FirebaseApp.app() {
_ = app.name
_ = app.options
_ = app.isDataCollectionDefaultEnabled
app.isDataCollectionDefaultEnabled = false
}
// MARK: - FirebaseConfiguration
_ = FirebaseConfiguration.shared
FirebaseConfiguration.shared.setLoggerLevel(.debug)
// MARK: - FirebaseLoggerLevel
let loggerLevel: FirebaseLoggerLevel = .debug
switch loggerLevel {
case FirebaseLoggerLevel.error:
break
case FirebaseLoggerLevel.warning:
break
case FirebaseLoggerLevel.notice:
break
case FirebaseLoggerLevel.info:
break
case FirebaseLoggerLevel.debug:
break
default:
break
}
_ = FirebaseLoggerLevel.min
_ = FirebaseLoggerLevel.max
// MARK: - FirebaseOptions
// FirebaseOptions default instance
if let _ /* defaultOptions */ = FirebaseOptions.defaultOptions() {
// ...
}
// FirebaseOptions initializers
_ = FirebaseOptions(googleAppID: "googleAppID", gcmSenderID: "gcmSenderID")
if let _ /* options */ = FirebaseOptions(contentsOfFile: "path/to/file") {
// ...
}
// Properties
if let options = FirebaseOptions.defaultOptions() {
_ = options.bundleID
_ = options.gcmSenderID
_ = options.googleAppID
if let _ /* apiKey */ = options.apiKey {
// ...
}
if let _ /* clientID */ = options.clientID {
// ...
}
if let _ /* projectID */ = options.projectID {
// ...
}
if let _ /* databaseURL */ = options.databaseURL {
// ...
}
if let _ /* storageBucket */ = options.storageBucket {
// ...
}
if let _ /* appGroupID */ = options.appGroupID {
// ...
}
}
// MARK: - FirebaseVersion
_ = FirebaseVersion()
}
}