This product is not supported for your selected Datadog site. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Metadata

ID: swift-code-style/if-let-shorthand

Language: Unknown

Severity: Warning

Category: Code Style

Description

Non-Compliant Code Examples

if let name = name {
    // ...
}

if let self = self {
    // ...
}
    
if interactionEnabled,
   let userTapLocation = userTapLocation {
    // ...
}

if let user = user, 
   var device = device {
    // ...
}

Compliant Code Examples

if let name {
    // ...
}

if let name = user?.name {
    // ...
}
    
if let user = user as? User {
    // ...
}
 
if var user = currentUser() {
    // ...
}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains