Я хотел бы знать, есть ли подобная семантическая конструкция в ARCore / Kotlin, как в следующем выражении guard let в ARKit / Swift?
ARCore
Kotlin
guard let
ARKit
Swift
let anchor: ARAnchor? guard let planeAnchor = anchor as? ARPlaneAnchor else { print("condition not met") return }
Мне кажется, я нашел необходимую семантику для ARCore planeAnchor с оператором Элвиса и оператором безопасного приведения :
planeAnchor
public class CenterPosePlaneAnchor { ... } val anchor: Anchor? val info = "condition not met" val planeAnchor = anchor as? CenterPosePlaneAnchor ?: return println(info)