Skip to content

Commit

Permalink
Avoids explicitly unwrapping mirror
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpatrickmorgan committed Feb 23, 2023
1 parent d89f6d5 commit 11ae789
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/NavigationBackport/DestinationBuilderHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class DestinationBuilderHolder: ObservableObject {
}
assertionFailure("No view builder found for type \(key)")
} else {
var mirror: Mirror? = Mirror(reflecting: base ?? typedData)
while mirror != nil {
let key = Self.identifier(for: mirror!.subjectType)
var possibleMirror: Mirror? = Mirror(reflecting: base ?? typedData)
while let mirror = possibleMirror {
let key = Self.identifier(for: mirror.subjectType)

if let builder = builders[key], let output = builder(typedData) {
return output
}
mirror = mirror!.superclassMirror
possibleMirror = mirror.superclassMirror
}
assertionFailure("No view builder found for type \(type(of: base ?? typedData))")
}
Expand Down

0 comments on commit 11ae789

Please sign in to comment.