From 7d736747dfd13271b6197ca0349ea9e697fee0ac Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Sat, 28 Sep 2024 04:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Fix:=20`UniqueIdentifierSynthesi?= =?UTF-8?q?zing`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Temp/UniqueIdentifierSynthesizing.swift | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ios/Temp/UniqueIdentifierSynthesizing.swift b/ios/Temp/UniqueIdentifierSynthesizing.swift index 103ac891..fbc9d7dd 100644 --- a/ios/Temp/UniqueIdentifierSynthesizing.swift +++ b/ios/Temp/UniqueIdentifierSynthesizing.swift @@ -8,6 +8,7 @@ import Foundation import DGSwiftUtilities + public protocol UniqueIdentifierSynthesizing: AnyObject { var synthesizedIntID: UInt64 { get }; @@ -67,23 +68,18 @@ public extension UniqueIdentifierSynthesizing where Self: AnyObject { // MARK: - ObjectUniquelyIdentifiable+Default // ------------------------------------------ +fileprivate let atomicCounter: AtomicCounter = .init(); + fileprivate enum PropertyKeys: String { - case atomicCounter; case synthesizedIntID; case synthesizedUUID; }; extension UniqueIdentifierSynthesizing where Self: ValueInjectable { - fileprivate var atomicCounter: AtomicCounter { - self.getInjectedValue(forKey: PropertyKeys.atomicCounter) { - .init(); - }; - }; - public var synthesizedIntID: UInt64 { self.getInjectedValue(forKey: PropertyKeys.synthesizedIntID) { - self.atomicCounter.incrementAndGet(); + atomicCounter.incrementAndGet(); }; };