Skip to content

Files

Latest commit

 

History

History
47 lines (22 loc) · 576 Bytes

discouraged_optional_boolean.md

File metadata and controls

47 lines (22 loc) · 576 Bytes

Pattern: Use of optional boolean

Issue: -

Description

Prefer non-optional booleans over optional booleans.

Examples of correct code:

var foo: Bool


var foo: [String: Bool]


var foo: [Bool]


let foo: Bool = true


let foo: Bool = false

Examples of incorrect code:

var foo: Bool?


var foo: [String: ↓Bool?]


var foo: [↓Bool?]


let foo: Bool? = nil


let foo: [String: ↓Bool?] = [:]

Further Reading