/
SIARCUtil.h
54 lines (49 loc) · 1.51 KB
/
SIARCUtil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// SIARCUtil.h
// SIKit
//
// Created by Matias Pequeno on 2013/04/02.
// Copyright (c) 2013 Silicon Illusions, Inc. All rights reserved.
//
#ifndef _SIARCUTIL_H_
#define _SIARCUTIL_H_
#ifndef arc_retain
# if __has_feature(objc_arc)
# define arc_retain self // retain is still valid under arc in @property declarations
# define arc_dealloc self // dealloc is a method name which cannot be redefined
# define release self
# define autorelease self
# else
# define arc_retain retain
# define arc_dealloc dealloc
# define __bridge
# endif
#endif
// Weak reference support
#import <Availability.h>
#if (!__has_feature(objc_arc)) || \
(defined __IPHONE_OS_VERSION_MIN_REQUIRED && \
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0) || \
(defined __MAC_OS_X_VERSION_MIN_REQUIRED && \
__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7)
# undef weak
# define weak unsafe_unretained
# undef __weak
# define __weak __unsafe_unretained
#endif
// Weak delegate support
#ifndef ah_weak
#import <Availability.h>
#if (__has_feature(objc_arc)) && \
((defined __IPHONE_OS_VERSION_MIN_REQUIRED && \
__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0) || \
(defined __MAC_OS_X_VERSION_MIN_REQUIRED && \
__MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_7))
# define arc_weak weak
# define __arc_weak __weak
# else
# define arc_weak unsafe_unretained
# define __arc_weak __unsafe_unretained
# endif
#endif
#endif // _ARCHELPER_H_