JohnCoates/Aerial

View on GitHub
Aerial/Source/Views/Sources/SourceOutlineView.swift

Summary

Maintainability
A
0 mins
Test Coverage

Force casts should be avoided
Open

            return (self.delegate as! SourceOutlineViewDelegate).outlineView(outlineView: self, menuForItem: item)

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)")

There are no issues that match your filters.

Category
Status