I am developing a turn-based game with swift, where everything has to be converted to NSData. Right now i have been stuck on the "NS-stuff" for many days. Because CGPoint is not an object but a struct, it can't be converted to NSData directly, and so do the CGFloat inside CGPoint. What i am trying to do is: (Just an idea, not sure if it works yet.)
- convert CGPoint to 2 different Floats
- create NSNummer with Float
- create NSData with NSNumber
- convert NSData back to NSNumber in another device
- convert NSNumber to Float
- merge them back to CGPoint
This way is too complicated. Is there any better way to implement it or any best practices? Thanks in advance!!!
PS: NSKeyedArchiver should NOT be considered because of it's performance. (Not sure!)