Generic model on Mac and iPhone

I am currently studying the unification of the model of my application. I am currently using a different model on mac / iphone. Missing classes (NSAttributedString) and missing technologies (Bindings) made me go with this solution.

With the first limitation in SDK 3.2 and my plan to also create an optimized version of the iPad, I am redefining my decision. Since I also need to store NCPoints / CGPoints, NSRect / CGRects, NSColor / UIColor, and NSImage / UIImage structures in my model, I'm not sure what the best way to handle them would be.

Writing your own MNColor object that encapsulates NSColor and UIColor depending on the architecture? Writing your own rectangle functions that call the corresponding function depending on the arc? Or use CGRect in a model on mac?

Any input would be much appreciated!

+3
source share
4 answers

CorePlot is Cocoa's excellent build infrastructure for the iPhone and Mac OS X.
It shares common code on both platforms. Perhaps you can get some ideas by looking at their source .

CP , "" . Xcode :

CPColor. ( CGColorRef)

NSPoint NSRect, Core Graphics , NSRectFromCGRect NSPointFromCGPoint , . (Mac OS 10.5 +)

CIMGF iPhone/Mac:
NSManagedObject, -

+2

@ " , " - .

@ " MNColor, NSColor UIColor" - , - MNColor - . .. mac, iPhone, - UIColor NSColor.

+1

, , , .

, "NSPoints/CGPoints, NSRect/CGRects, NSColor/UIColor NSImage/UIImage structs/objects" - / , . , API , , . /, , / .

- , API. NSPoints/CGPoints, NSRect/CGRects . , . .

, ​​ , , , . , /, /API.

. , , , .., , .

Core Data, , .

+1

It depends on your use, but I prevent the storage of images in the database. They work better on the file system (possibly) with paths to images stored in the database.

In one case, when I can see any benefits, having images stored in the database, this is if you want one block of the file system to be able to move, which moves everything around. Although with the iPhone, this is not a likely use case.

0
source

Source: https://habr.com/ru/post/1733500/


All Articles