nicklockwood / FastCoding

A faster and more flexible binary file format replacement for NSCoding, Property Lists and JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

在swift中使用的问题

asiuvxmcn opened this issue · comments

if (objectClass)
{
    object = FC_AUTORELEASE([[objectClass alloc] init]);
}

的class名称为_swiftvalue
从而Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
崩溃

I don't think you can safely use FastCoding with Swift value types that have been bridged to Objective-C.

How can I use FastCoding on swift? I create Bridging-Header but the values and methods in FastCoding could not be fit,example that I create a struct to use it.
struct MarkStruct{
var mark1: NSMutableArray
var mark2: NSMutableDictionary
var mark3: NSString
}
Thanks for your answer.

You can only use Objective-C compatible types with FastCoding. That means classes that inherit from NSObject, where all properties are marked with @objc. It won’t work with structs.