Skip to content

Commit

Permalink
♻️ Make trait metadata subscripting explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed Oct 9, 2024
1 parent 783ff05 commit c06b156
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ internal class AppcuesTraitMetadata: NSObject {
return animationGroup
}

/// Accesses the value associated with the given key for reading.
internal subscript(isSet key: String) -> Bool {
newData[key] != nil
}

/// Accesses the value associated with the given key for reading.
internal subscript<T>(_ key: String) -> T? {
newData[key] as? T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal class AppcuesTargetInteractionTrait: AppcuesBackdropDecoratingTrait {
}

private func handle(backdropView: UIView, metadata: AppcuesTraitMetadata) {
guard var newTarget: CGRect = metadata["targetRectangle"], metadata["backdropBackgroundColor"] != nil else {
guard var newTarget: CGRect = metadata["targetRectangle"], metadata[isSet: "backdropBackgroundColor"] else {
targetView.removeFromSuperview()
return
}
Expand Down

0 comments on commit c06b156

Please sign in to comment.