我对swift非常陌生,并且想要扩展NSCoding
以符合类型URL。我需要定义输入和输出类型,并始终得到错误Type 'URL' does not conform to protocol 'NSCoding'
。扩展NSCoding以符合URL
//what it looks like before entering types
DiskCacheLevel<<#K: StringConvertible#>, NSCoding>()
//what I want it to look like (<InputType, OutputType>)
DiskCacheLevel<URL, URL>() //here the error occurs
我将如何扩展它以符合类型URL
呢?
免费桥接基础类NSURL确实符合NS(安全)编码。只需将'URL'类型桥接到'NSURL',反之亦然。 – vadian