Skip to content

Commit

Permalink
Merge pull request #1 from venmo/swift4.1
Browse files Browse the repository at this point in the history
Migrated to Swift 4.1
  • Loading branch information
dgallagher-venmo authored Mar 30, 2018
2 parents eaa4922 + 7b6dffd commit 265eaff
Show file tree
Hide file tree
Showing 53 changed files with 65 additions and 889 deletions.
48 changes: 6 additions & 42 deletions QuizTrain.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
omittedKeys. Any keys violating those rules will be silently omitted from being
added to customFields.
*/
struct CustomFieldsContainer: JSONDeserializable, JSONSerializable {
struct CustomFieldsContainer: JSONDeserializable, JSONSerializable, Equatable {

// MARK: - Properties

Expand Down Expand Up @@ -50,14 +50,6 @@ struct CustomFieldsContainer: JSONDeserializable, JSONSerializable {

}

extension CustomFieldsContainer: Equatable {

static func==(lhs: CustomFieldsContainer, rhs: CustomFieldsContainer) -> Bool {
return lhs.container == rhs.container
}

}

extension CustomFieldsContainer {

public static func empty() -> CustomFieldsContainer {
Expand Down
47 changes: 0 additions & 47 deletions QuizTrain/Misc/Extensions/Array+ContentComparison.swift

This file was deleted.

13 changes: 0 additions & 13 deletions QuizTrain/Misc/Extensions/Equatable+OptionalArray.swift

This file was deleted.

27 changes: 1 addition & 26 deletions QuizTrain/Models/Case.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct Case: Identifiable, MutableCustomFields {
public struct Case: Identifiable, MutableCustomFields, Equatable {
public typealias Id = Int
public let createdBy: User.Id
public let createdOn: Date
Expand Down Expand Up @@ -56,31 +56,6 @@ extension Case {

}

// MARK: - Equatable

extension Case: Equatable {

public static func==(lhs: Case, rhs: Case) -> Bool {
return (lhs.createdBy == rhs.createdBy &&
lhs.createdOn.secondsSince1970 == rhs.createdOn.secondsSince1970 &&
lhs.estimate == rhs.estimate &&
lhs.estimateForecast == rhs.estimateForecast &&
lhs.id == rhs.id &&
lhs.milestoneId == rhs.milestoneId &&
lhs.priorityId == rhs.priorityId &&
lhs.refs == rhs.refs &&
lhs.sectionId == rhs.sectionId &&
lhs.suiteId == rhs.suiteId &&
lhs.templateId == rhs.templateId &&
lhs.title == rhs.title &&
lhs.typeId == rhs.typeId &&
lhs.updatedBy == rhs.updatedBy &&
lhs.updatedOn.secondsSince1970 == rhs.updatedOn.secondsSince1970 &&
lhs.customFieldsContainer == rhs.customFieldsContainer)
}

}

// MARK: - JSON Keys

extension Case {
Expand Down
22 changes: 1 addition & 21 deletions QuizTrain/Models/CaseField.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct CaseField: Identifiable {
public struct CaseField: Identifiable, Equatable {
public typealias Id = Int
public let configs: [Config]
public let description: String?
Expand All @@ -23,26 +23,6 @@ extension CaseField {

}

// MARK: - Equatable

extension CaseField: Equatable {

public static func==(lhs: CaseField, rhs: CaseField) -> Bool {
return (lhs.configs.contentsAreEqual(to: rhs.configs) &&
lhs.description == rhs.description &&
lhs.displayOrder == rhs.displayOrder &&
lhs.id == rhs.id &&
lhs.includeAll == rhs.includeAll &&
lhs.isActive == rhs.isActive &&
lhs.label == rhs.label &&
lhs.name == rhs.name &&
lhs.systemName == rhs.systemName &&
lhs.templateIds.sorted() == rhs.templateIds.sorted() &&
lhs.typeId == rhs.typeId)
}

}

// MARK: - JSON Keys

extension CaseField {
Expand Down
14 changes: 1 addition & 13 deletions QuizTrain/Models/CaseType.swift
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
public struct CaseType: Identifiable {
public struct CaseType: Identifiable, Equatable {
public typealias Id = Int
public let id: Id
public let isDefault: Bool
public let name: String
}

// MARK: - Equatable

extension CaseType: Equatable {

public static func==(lhs: CaseType, rhs: CaseType) -> Bool {
return (lhs.id == rhs.id &&
lhs.isDefault == rhs.isDefault &&
lhs.name == rhs.name)
}

}

// MARK: - JSON Keys

extension CaseType {
Expand Down
13 changes: 1 addition & 12 deletions QuizTrain/Models/Config/Config.Context.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
extension Config {

public struct Context {
public struct Context: Equatable {
public let isGlobal: Bool // True indicates all projects.
public let projectIds: [Project.Id]? // Applies only if isGlobal is false. Can include projectIds for projects you do not have at least Read-only access to.
}

}

// MARK: - Equatable

extension Config.Context: Equatable {

public static func==(lhs: Config.Context, rhs: Config.Context) -> Bool {
return (lhs.isGlobal == rhs.isGlobal &&
lhs.projectIds?.sorted() == rhs.projectIds?.sorted())
}

}

// MARK: - JSON Keys

extension Config.Context {
Expand Down
14 changes: 1 addition & 13 deletions QuizTrain/Models/Config/Config.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct Config: Identifiable {
public struct Config: Identifiable, Equatable {
public typealias Id = String
typealias OptionsContainer = JSONDictionaryContainer
public let context: Config.Context
Expand All @@ -21,18 +21,6 @@ extension Config {

}

// MARK: - Equatable

extension Config: Equatable {

public static func==(lhs: Config, rhs: Config) -> Bool {
return (lhs.context == rhs.context &&
lhs.id == rhs.id &&
lhs.optionsContainer == rhs.optionsContainer)
}

}

// MARK: - JSON Keys

extension Config {
Expand Down
14 changes: 1 addition & 13 deletions QuizTrain/Models/Configuration.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct Configuration: Identifiable {
public struct Configuration: Identifiable, Equatable {
public typealias Id = Int
public let id: Id
public let groupId: ConfigurationGroup.Id
Expand All @@ -15,18 +15,6 @@ extension Configuration {

}

// MARK: - Equatable

extension Configuration: Equatable {

public static func==(lhs: Configuration, rhs: Configuration) -> Bool {
return (lhs.id == rhs.id &&
lhs.groupId == rhs.groupId &&
lhs.name == rhs.name)
}

}

// MARK: - JSON Keys

extension Configuration {
Expand Down
15 changes: 1 addition & 14 deletions QuizTrain/Models/ConfigurationGroup.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct ConfigurationGroup: Identifiable {
public struct ConfigurationGroup: Identifiable, Equatable {
public typealias Id = Int
public let configs: [Configuration]
public let id: Id
Expand All @@ -16,19 +16,6 @@ extension ConfigurationGroup {

}

// MARK: - Equatable

extension ConfigurationGroup: Equatable {

public static func==(lhs: ConfigurationGroup, rhs: ConfigurationGroup) -> Bool {
return (lhs.configs.contentsAreEqual(to: rhs.configs) &&
lhs.id == rhs.id &&
lhs.name == rhs.name &&
lhs.projectId == rhs.projectId)
}

}

// MARK: - JSON Keys

extension ConfigurationGroup {
Expand Down
24 changes: 1 addition & 23 deletions QuizTrain/Models/Milestone.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct Milestone: Identifiable {
public struct Milestone: Identifiable, Equatable {
public typealias Id = Int
public let completedOn: Date?
public var description: String?
Expand Down Expand Up @@ -29,28 +29,6 @@ extension Milestone {

}

// MARK: - Equatable

extension Milestone: Equatable {

public static func==(lhs: Milestone, rhs: Milestone) -> Bool {
return (lhs.completedOn?.secondsSince1970 == rhs.completedOn?.secondsSince1970 &&
lhs.description == rhs.description &&
lhs.dueOn?.secondsSince1970 == rhs.dueOn?.secondsSince1970 &&
lhs.id == rhs.id &&
lhs.isCompleted == rhs.isCompleted &&
lhs.isStarted == rhs.isStarted &&
Array.contentsAreEqual(lhs.milestones, rhs.milestones) &&
lhs.name == rhs.name &&
lhs.parentId == rhs.parentId &&
lhs.projectId == rhs.projectId &&
lhs.startOn?.secondsSince1970 == rhs.startOn?.secondsSince1970 &&
lhs.startedOn?.secondsSince1970 == rhs.startedOn?.secondsSince1970 &&
lhs.url == rhs.url)
}

}

// MARK: - JSON Keys

extension Milestone {
Expand Down
15 changes: 1 addition & 14 deletions QuizTrain/Models/Plan.Entry.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extension Plan {

public struct Entry: Identifiable {
public struct Entry: Identifiable, Equatable {
public typealias Id = String
public let id: Id
public var name: String
Expand All @@ -20,19 +20,6 @@ extension Plan.Entry {

}

// MARK: - Equatable

extension Plan.Entry: Equatable {

public static func==(lhs: Plan.Entry, rhs: Plan.Entry) -> Bool {
return (lhs.id == rhs.id &&
lhs.name == rhs.name &&
lhs.runs.contentsAreEqual(to: rhs.runs) &&
lhs.suiteId == rhs.suiteId)
}

}

// MARK: - JSON Keys

extension Plan.Entry {
Expand Down
35 changes: 1 addition & 34 deletions QuizTrain/Models/Plan.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public struct Plan: Identifiable {
public struct Plan: Identifiable, Equatable {
public typealias Id = Int
public let assignedtoId: User.Id?
public let blockedCount: Int
Expand Down Expand Up @@ -48,39 +48,6 @@ extension Plan {

}

// MARK: - Equatable

extension Plan: Equatable {

public static func==(lhs: Plan, rhs: Plan) -> Bool {
return (lhs.assignedtoId == rhs.assignedtoId &&
lhs.blockedCount == rhs.blockedCount &&
lhs.completedOn?.secondsSince1970 == rhs.completedOn?.secondsSince1970 &&
lhs.createdBy == rhs.createdBy &&
lhs.createdOn.secondsSince1970 == rhs.createdOn.secondsSince1970 &&
lhs.customStatus1Count == rhs.customStatus1Count &&
lhs.customStatus2Count == rhs.customStatus2Count &&
lhs.customStatus3Count == rhs.customStatus3Count &&
lhs.customStatus4Count == rhs.customStatus4Count &&
lhs.customStatus5Count == rhs.customStatus5Count &&
lhs.customStatus6Count == rhs.customStatus6Count &&
lhs.customStatus7Count == rhs.customStatus7Count &&
lhs.description == rhs.description &&
Array.contentsAreEqual(lhs.entries, rhs.entries) &&
lhs.failedCount == rhs.failedCount &&
lhs.id == rhs.id &&
lhs.isCompleted == rhs.isCompleted &&
lhs.milestoneId == rhs.milestoneId &&
lhs.name == rhs.name &&
lhs.passedCount == rhs.passedCount &&
lhs.projectId == rhs.projectId &&
lhs.retestCount == rhs.retestCount &&
lhs.untestedCount == rhs.untestedCount &&
lhs.url == rhs.url)
}

}

// MARK: - JSON Keys

extension Plan {
Expand Down
Loading

0 comments on commit 265eaff

Please sign in to comment.