Skip to content

Commit

Permalink
🐞 Fix: UniqueIdentifierSynthesizing
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Sep 27, 2024
1 parent 80f7594 commit 7d73674
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions ios/Temp/UniqueIdentifierSynthesizing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import DGSwiftUtilities


public protocol UniqueIdentifierSynthesizing: AnyObject {

var synthesizedIntID: UInt64 { get };
Expand Down Expand Up @@ -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();
};
};

Expand Down

0 comments on commit 7d73674

Please sign in to comment.