forked from shadowfacts/Tusker
40 lines
712 B
Swift
40 lines
712 B
Swift
|
//
|
||
|
// ClientModel.swift
|
||
|
// Pachyderm
|
||
|
//
|
||
|
// Created by Shadowfacts on 9/9/18.
|
||
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
protocol ClientModel {
|
||
|
var client: Client! { get set }
|
||
|
}
|
||
|
|
||
|
extension Array where Element == ClientModel {
|
||
|
var client: Client! {
|
||
|
get {
|
||
|
return first?.client
|
||
|
}
|
||
|
set {
|
||
|
for var el in self {
|
||
|
el.client = newValue
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Array where Element: ClientModel {
|
||
|
var client: Client! {
|
||
|
get {
|
||
|
return first?.client
|
||
|
}
|
||
|
set {
|
||
|
for var el in self {
|
||
|
el.client = newValue
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|