fix(ios): build fail due to an unwrapped value (#4101)
* 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>
This commit is contained in:
parent
41e2bed6b3
commit
0a1085ce03
@ -9,7 +9,15 @@ enum RCTVideoAssetsUtils {
|
|||||||
for mediaCharacteristic: AVMediaCharacteristic
|
for mediaCharacteristic: AVMediaCharacteristic
|
||||||
) async -> AVMediaSelectionGroup? {
|
) async -> AVMediaSelectionGroup? {
|
||||||
if #available(iOS 15, tvOS 15, visionOS 1.0, *) {
|
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 {
|
} else {
|
||||||
#if !os(visionOS)
|
#if !os(visionOS)
|
||||||
return asset?.mediaSelectionGroup(forMediaCharacteristic: mediaCharacteristic)
|
return asset?.mediaSelectionGroup(forMediaCharacteristic: mediaCharacteristic)
|
||||||
|
Loading…
Reference in New Issue
Block a user