This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
var count = 0 | |
// 結果を保持させてすでに重複しているかを確認 | |
var set = Set<Int>() | |
for item in 0..<10000 { | |
let queue = DispatchQueue(label: "fuga") | |
// データ競合以前にそもそもここでエラーになることもある。 error: Execution was interrupted. | |
// The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FirebaseFirestore | |
@available(swift 5.0) | |
public extension Query { | |
func addSnapshotListener( | |
includeMetadataChanges: Bool = false, | |
listener: @escaping (Result<QuerySnapshot, Error>) -> () | |
) -> some ListenerRegistration { | |
addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { snapshot, error in | |
if let error { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComposableArchitecture | |
import FirebaseCore | |
import FirebaseAuth | |
import GoogleSignIn | |
struct FirebaseAuthClient { | |
var observeSignInState: () async -> AsyncStream<Bool> | |
} | |
extension FirebaseAuthClient { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import ComposableArchitecture | |
import FirebaseFirestore | |
import FirebaseFirestoreSwift | |
// MARK: - FirestoreClient | |
struct FirestoreClient { | |
enum Input { | |
enum Create { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FirebaseFirestore | |
// MARK: - async | |
extension Query { | |
func addSnapshotListener<T>( | |
includeMetadataChanges: Bool = false | |
) -> AsyncThrowingStream<[T], Error> where T: Decodable{ | |
.init { continuation in | |
let listener = addSnapshotListener(includeMetadataChanges: includeMetadataChanges) { result in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FirebaseFirestore | |
import FirebaseFirestoreSwift | |
import Foundation | |
// MARK: - CollectionReference | |
public extension CollectionReference { | |
@discardableResult | |
func add<T: Encodable>( | |
_ value: T, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import FirebaseRemoteConfig | |
extension RemoteConfig { | |
func addOnConfigUpdateListener() -> AsyncThrowingStream<Set<String>, Error> { | |
.init { continuation in | |
addOnConfigUpdateListener { configUpdate, error in | |
if let error { | |
continuation.finish(throwing: error) | |
} else { |
OlderNewer