FastCoding icon indicating copy to clipboard operation
FastCoding copied to clipboard

在swift中使用的问题

Open asiuvxmcn opened this issue 7 years ago • 4 comments

asiuvxmcn avatar May 17 '18 09:05 asiuvxmcn

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

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

asiuvxmcn avatar May 17 '18 09:05 asiuvxmcn

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

nicklockwood avatar May 17 '18 10:05 nicklockwood

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.

asiuvxmcn avatar May 18 '18 00:05 asiuvxmcn

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.

nicklockwood avatar May 18 '18 06:05 nicklockwood