The error is occurring because input[2] is of type String.Subsequence (also known as Substring), which is a non-optional type. You are trying to force unwrap it using the exclamation mark !, but since it is not an optional, it cannot be force unwrapped.

To fix the error, you can remove the exclamation mark ! from let k = input[2]!:

let k = input[2]

This will assign the value of input[2] to k without force unwrapping it.

Swift 错误:无法强制解包非可选类型 'String.SubSequence' 的值

原文地址: http://www.cveoy.top/t/topic/qwU2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录