Use unsafelyUnwrapped more often

This commit is contained in:
Christian Treffs 2020-08-03 11:14:35 +02:00
parent 040b36d983
commit 64c7b16764
No known key found for this signature in database
GPG Key ID: 49A4B4B460BE3ED4
3 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ private struct FamilyMemberContainer<R> where R: FamilyRequirementsManaging {
}
extension CodingUserInfoKey {
fileprivate static let nexusCodingStrategy = CodingUserInfoKey(rawValue: "nexusCodingStrategy")!
fileprivate static let nexusCodingStrategy = CodingUserInfoKey(rawValue: "nexusCodingStrategy").unsafelyUnwrapped
}
// MARK: - encoding

View File

@ -127,10 +127,10 @@ extension Nexus {
}
func add(entityWithId entityId: EntityIdentifier, toFamilyWithTraits traits: FamilyTraitSet) {
familyMembersByTraits[traits]!.insert(entityId, at: entityId.id)
familyMembersByTraits[traits].unsafelyUnwrapped.insert(entityId, at: entityId.id)
}
func remove(entityWithId entityId: EntityIdentifier, fromFamilyWithTraits traits: FamilyTraitSet) {
familyMembersByTraits[traits]!.remove(at: entityId.id)
familyMembersByTraits[traits].unsafelyUnwrapped.remove(at: entityId.id)
}
}

View File

@ -87,6 +87,6 @@ public struct DefaultCodingStrategy: CodingStrategy {
public init() { }
public func codingKey<C>(for componentType: C.Type) -> DynamicCodingKey where C: Component {
DynamicCodingKey(stringValue: "\(C.self)")!
DynamicCodingKey(stringValue: "\(C.self)").unsafelyUnwrapped
}
}