使用AVCaptureVideoPreviewLayer初始化的问题

时间:2018-03-22 19:56:25

标签: ios iphone swift4 avplayer

我需要帮助,我的问题是我在迁移Swift3 for Swift4时,在某些方法中会出现语法问题。 错误的消息是:条件绑定的初始化程序必须具有可选类型,而不是' AVCaptureVideoPreviewLayer'

{if $field.value || ($field.name == "newsletter" && $page.page_name == 'authentication') || ($field.name == "optin" && $page.page_name == 'authentication') || ($field.name == "newsletter" && $page.page_name == 'checkout') || ($field.name == "optin" && $page.page_name == 'checkout') }checked="checked"{/if}

1 个答案:

答案 0 :(得分:0)

尝试一下,为我工作。重写您的行(6),如下所示:

layer.videoGravity = AVLayerVideoGravity(rawValue: convertFromAVLayerVideoGravity(AVLayerVideoGravity.resizeAspectFill))