Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to Swift 4.1 #1

Merged
merged 3 commits into from
Mar 30, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
- Migrated Equatable on models to use Swift 4.1 Conditional Conformance.
- Removed Array+ContentComparison and related tests.
- Removed Equatable+OptionalArray and related tests.
dgallagher-venmo committed Mar 29, 2018
commit ba301ccf6b0fca1b222768baa4c12f068e510154
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
@@ -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

@@ -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 {
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
@@ -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 {
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?
@@ -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 {
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 {
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 {
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
@@ -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 {
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
@@ -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 {
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
@@ -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 {
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?
@@ -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 {
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
@@ -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 {
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
@@ -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 {
Loading