Skip to content

Instantly share code, notes, and snippets.

@sohayb
sohayb / ArrayDeepCopy.swift
Last active October 25, 2024 04:07
Array deep copy in Swift
//Protocal that copyable class should conform
protocol Copying {
init(original: Self)
}
//Concrete class extension
extension Copying {
func copy() -> Self {
return Self.init(original: self)
}