forked from shadowfacts/Tusker
Remove old code
This commit is contained in:
parent
70bca052c4
commit
387623a309
|
@ -68,11 +68,6 @@ public class Client {
|
|||
completion(.failure(Error.invalidModel))
|
||||
return
|
||||
}
|
||||
if var result = result as? ClientModel {
|
||||
result.client = self
|
||||
} else if var result = result as? [ClientModel] {
|
||||
result.client = self
|
||||
}
|
||||
let pagination = response.allHeaderFields["Link"].flatMap { $0 as? String }.flatMap(Pagination.init)
|
||||
|
||||
completion(.success(result, pagination))
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
//
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,7 +61,6 @@
|
|||
D6109A05214572BF00432DC2 /* Scope.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A04214572BF00432DC2 /* Scope.swift */; };
|
||||
D6109A072145756700432DC2 /* LoginSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A062145756700432DC2 /* LoginSettings.swift */; };
|
||||
D6109A0921458C4A00432DC2 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0821458C4A00432DC2 /* Empty.swift */; };
|
||||
D6109A0B2145953C00432DC2 /* ClientModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0A2145953C00432DC2 /* ClientModel.swift */; };
|
||||
D6109A0D214599E100432DC2 /* RequestRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0C214599E100432DC2 /* RequestRange.swift */; };
|
||||
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0E21459B6900432DC2 /* Pagination.swift */; };
|
||||
D6109A11214607D500432DC2 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A10214607D500432DC2 /* Timeline.swift */; };
|
||||
|
@ -340,7 +339,6 @@
|
|||
D6109A04214572BF00432DC2 /* Scope.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Scope.swift; sourceTree = "<group>"; };
|
||||
D6109A062145756700432DC2 /* LoginSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginSettings.swift; sourceTree = "<group>"; };
|
||||
D6109A0821458C4A00432DC2 /* Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = "<group>"; };
|
||||
D6109A0A2145953C00432DC2 /* ClientModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientModel.swift; sourceTree = "<group>"; };
|
||||
D6109A0C214599E100432DC2 /* RequestRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestRange.swift; sourceTree = "<group>"; };
|
||||
D6109A0E21459B6900432DC2 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
|
||||
D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = "<group>"; };
|
||||
|
@ -602,7 +600,6 @@
|
|||
D61099AD2144B0CC00432DC2 /* Pachyderm.h */,
|
||||
D61099AE2144B0CC00432DC2 /* Info.plist */,
|
||||
D61099C82144B13C00432DC2 /* Client.swift */,
|
||||
D6109A0A2145953C00432DC2 /* ClientModel.swift */,
|
||||
D6A3BC7223218C6E00FD64D5 /* Utilities */,
|
||||
D61099D72144B74500432DC2 /* Extensions */,
|
||||
D61099CC2144B2C300432DC2 /* Request */,
|
||||
|
@ -1545,7 +1542,6 @@
|
|||
D61099FB214569F600432DC2 /* Report.swift in Sources */,
|
||||
D61099F92145698900432DC2 /* Relationship.swift in Sources */,
|
||||
D61099E12144C1DC00432DC2 /* Account.swift in Sources */,
|
||||
D6109A0B2145953C00432DC2 /* ClientModel.swift in Sources */,
|
||||
D61099E92145658300432DC2 /* Card.swift in Sources */,
|
||||
D61099F32145688600432DC2 /* Mention.swift in Sources */,
|
||||
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */,
|
||||
|
|
|
@ -9,32 +9,7 @@
|
|||
import Foundation
|
||||
|
||||
extension Date {
|
||||
|
||||
// var timeAgo: String {
|
||||
// let calendar = NSCalendar.current
|
||||
// let unitFlags = Set<Calendar.Component>([.second, .minute, .hour, .day, .weekOfYear, .month, .year])
|
||||
//
|
||||
// let components = calendar.dateComponents(unitFlags, from: self, to: Date())
|
||||
//
|
||||
// if components.year! >= 1 {
|
||||
// return "\(components.year!)y"
|
||||
// } else if components.month! >= 1 {
|
||||
// return "\(components.month!)mo"
|
||||
// } else if components.weekOfYear! >= 1 {
|
||||
// return "\(components.weekOfYear!)w"
|
||||
// } else if components.day! >= 1 {
|
||||
// return "\(components.day!)d"
|
||||
// } else if components.hour! >= 1 {
|
||||
// return "\(components.hour!)h"
|
||||
// } else if components.minute! >= 1 {
|
||||
// return "\(components.minute!)m"
|
||||
// } else if components.second! >= 3 {
|
||||
// return "\(components.second!)s"
|
||||
// } else {
|
||||
// return "Now"
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
func timeAgo() -> (Int, Calendar.Component) {
|
||||
let calendar = NSCalendar.current
|
||||
let unitFlags = Set<Calendar.Component>([.second, .minute, .hour, .day, .weekOfYear, .month, .year])
|
||||
|
|
Loading…
Reference in New Issue