Skip to content

Commit cc6a384

Browse files
committed
Cast between [T] and NSArray (not just NSMutableArray), on Cocoa
1 parent ad28eae commit cc6a384

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Source/Array.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ public struct Array<T>
208208
return [T](list)
209209
}
210210

211+
#if COCOA
212+
public static func __implicit(_ list: PlatformImmutableList<T>) -> [T] {
213+
return [T](list)
214+
}
215+
216+
public static func __explicit(_ list: PlatformImmutableList<T>) -> [T] {
217+
return [T](list)
218+
}
219+
#endif
220+
211221
public static func __implicit(_ array: [T]) -> T[] {
212222
return array.nativeArray
213223
}
@@ -224,6 +234,16 @@ public struct Array<T>
224234
return array.platformList
225235
}
226236

237+
#if COCOA
238+
public static func __implicit(_ array: [T]) -> PlatformImmutableList<T> {
239+
return array.platformList
240+
}
241+
242+
public static func __explicit(_ array: [T]) -> PlatformImmutableList<T> {
243+
return array.platformList
244+
}
245+
#endif
246+
227247
public static func + <T>(lhs: [T], rhs: [T]) -> [T] {
228248
var result = lhs
229249
for i in rhs.GetSequence() {

0 commit comments

Comments
 (0)