Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion stdlib/public/core/Arrays.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,15 @@ extension ${Self} {
%end

#if _runtime(_ObjC)
// We isolate the bridging of the Cocoa Array -> Swift Array here so that
// in the future, we can eagerly bridge the Cocoa array. We need this function
// to do the bridging in an ABI safe way. Even though this looks useless,
// DO NOT DELETE!
@_versioned internal
func _bridgeCocoaArray<T>(_ _immutableCocoaArray: _NSArrayCore) -> Array<T> {
return Array(_buffer: _ArrayBuffer(nsArray: _immutableCocoaArray))
}

extension Array {
@_inlineable
public // @SPI(Foundation)
Expand Down Expand Up @@ -2414,7 +2423,7 @@ extension Array {
/// is a reference type).
@_inlineable
public init(_immutableCocoaArray: _NSArrayCore) {
self = Array(_buffer: _ArrayBuffer(nsArray: _immutableCocoaArray))
self = _bridgeCocoaArray(_immutableCocoaArray)
}
}
#endif
Expand Down