File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 39
39
/// lifetime of an object. If an object has a stronger notion of identity, it
40
40
/// may be appropriate to provide a custom implementation.
41
41
@available ( SwiftStdlib 5 . 1 , * )
42
- @_unavailableInEmbedded
43
42
public protocol Identifiable < ID> {
44
43
45
44
/// A type representing the stable identity of the entity associated with
@@ -51,7 +50,6 @@ public protocol Identifiable<ID> {
51
50
}
52
51
53
52
@available ( SwiftStdlib 5 . 1 , * )
54
- @_unavailableInEmbedded
55
53
extension Identifiable where Self: AnyObject {
56
54
public var id : ObjectIdentifier {
57
55
return ObjectIdentifier ( self )
Original file line number Diff line number Diff line change @@ -50,18 +50,31 @@ public struct ObjectIdentifier: Sendable {
50
50
/// // Prints "false"
51
51
///
52
52
/// - Parameter x: An instance of a class.
53
+ #if $Embedded
54
+ @inlinable // trivial-implementation
55
+ public init < Object: AnyObject > ( _ x: Object ) {
56
+ self . _value = Builtin . bridgeToRawPointer ( x)
57
+ }
58
+ #else
53
59
@inlinable // trivial-implementation
54
60
public init ( _ x: AnyObject ) {
55
61
self . _value = Builtin . bridgeToRawPointer ( x)
56
62
}
57
-
63
+ #endif
58
64
/// Creates an instance that uniquely identifies the given metatype.
59
65
///
60
66
/// - Parameter: A metatype.
67
+ #if $Embedded
68
+ @inlinable // trivial-implementation
69
+ public init < Object> ( _ x: Object . Type ) {
70
+ self . _value = unsafeBitCast ( x, to: Builtin . RawPointer. self)
71
+ }
72
+ #else
61
73
@inlinable // trivial-implementation
62
74
public init ( _ x: Any . Type ) {
63
75
self . _value = unsafeBitCast ( x, to: Builtin . RawPointer. self)
64
76
}
77
+ #endif
65
78
}
66
79
67
80
@_unavailableInEmbedded
You can’t perform that action at this time.
0 commit comments