Skip to content

Commit

Permalink
fix(ios): build fail due to an unwrapped value (#4101)
Browse files Browse the repository at this point in the history
* fix: ios build crash due to AVMediaSelectionGroup not being unwrapped

* fix: use shorthand optional binding

* fix: disable swiftlint shorthand_optional_binding for guard let

* fix(ios): use guard do catch

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>

---------

Co-authored-by: Krzysztof Moch <krzysmoch.programs@gmail.com>
  • Loading branch information
Fausto95 and KrzysztofMoch authored Aug 21, 2024
1 parent 41e2bed commit 0a1085c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ios/Video/Features/RCTVideoUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ enum RCTVideoAssetsUtils {
for mediaCharacteristic: AVMediaCharacteristic
) async -> AVMediaSelectionGroup? {
if #available(iOS 15, tvOS 15, visionOS 1.0, *) {
return try? await asset?.loadMediaSelectionGroup(for: mediaCharacteristic)
do {
guard let asset else {
return nil
}

return try await asset.loadMediaSelectionGroup(for: mediaCharacteristic)
} catch {
return nil
}
} else {
#if !os(visionOS)
return asset?.mediaSelectionGroup(forMediaCharacteristic: mediaCharacteristic)
Expand Down

0 comments on commit 0a1085c

Please sign in to comment.