oleksii-demedetskyi / Parus

Parus is simple chain style auto-layout helper for objective-c.
MIT License
106 stars 4 forks source link

Support of NSView and OS X #27

Closed oleksii-demedetskyi closed 10 years ago

oleksii-demedetskyi commented 10 years ago

We need support NSView as well, but we need to have type checking in both cases. I think typedef will be enough.

Also, we need to think about debugging support differences in os x.

oleksii-demedetskyi commented 10 years ago

DSL should be precise as for iOS, i believe that we need switch UIView to NSView.

xNekOIx commented 10 years ago

@AndreyMoskvin

#include "Availability.h"

#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED \
#define PVViewClass UIView \
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) \
#define PVViewClass NSView \
#else \
#error Can't identify platform to pick correct View class \
#endif

typedef PVViewClass PVView;

#undef PVViewClass
Forsarion commented 10 years ago

@xNekOIx looks correct :)

oleksii-demedetskyi commented 10 years ago

What about TARGET_PLATFORM macro?

xNekOIx commented 10 years ago

@DAlOG @AndreyMoskvin BTW

<TargetConditionals.h>
    #define TARGET_OS_MAC               1
    #define TARGET_OS_WIN32             0
    #define TARGET_OS_UNIX              0
    #define TARGET_OS_EMBEDDED          1 
    #define TARGET_OS_IPHONE            1 
    #define TARGET_IPHONE_SIMULATOR     0 
xNekOIx commented 10 years ago

BTW have a look at Masonries solution for compatibility with Mac OS X https://github.com/Masonry/Masonry/blob/master/Masonry/MASUtilities.h

Forsarion commented 10 years ago

Haven't known about TARGET macros until this moment.

oleksii-demedetskyi commented 10 years ago

I think masonry approach is fine.