17 lines
279 B
Swift
17 lines
279 B
Swift
import Foundation
|
|
|
|
public protocol Cloneable {
|
|
init(copy: Self)
|
|
func shallowClone() -> Self
|
|
}
|
|
|
|
extension Cloneable {
|
|
public func clone() -> Self {
|
|
return Self.init(copy: self)
|
|
}
|
|
|
|
public func shallowClone() -> Self {
|
|
return clone()
|
|
}
|
|
}
|