Sources/MistKit/Extensions/Array.swift
Force casts should be avoided Open
Open
self = Mirror(reflecting: uuid.uuid).children.map { $0.value as! UInt8 }
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
forced-type-cast
Avoid using the forced form of the type cast operator (as!
) because Swift is not able to determine at compile time if the type conversion will succeed. In the event of an unsuccessful conversion, a runtime error will be triggered. The conditional form of the type cast operator (as?
) is safer and should be used when possible.
Preferred
if let movie = item as? Movie {
print("Movie: '\(movie.name)', dir. \(movie.director)")
}
Not Preferred
let movie = item as! Movie
print("Movie: '\(movie.name)', dir. \(movie.director)")
public declarations should be documented. Open
Open
public extension Array where Element == UInt8 {
- Create a ticketCreate a ticket
- Exclude checks
public declarations should be documented. Open
Open
init(uuid: UUID) {
- Create a ticketCreate a ticket
- Exclude checks