Skip to content

Commit fca6242

Browse files
committed
YYModel 1.0.4
1 parent c5ae8ee commit fca6242

29 files changed

+2220
-0
lines changed

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Autosave files
2+
*~
3+
4+
# build
5+
[Oo]bj/
6+
[Bb]in/
7+
packages/
8+
TestResults/
9+
10+
# globs
11+
Makefile.in
12+
*.DS_Store
13+
*.sln.cache
14+
*.suo
15+
*.cache
16+
*.pidb
17+
*.userprefs
18+
*.usertasks
19+
config.log
20+
config.make
21+
config.status
22+
aclocal.m4
23+
install-sh
24+
autom4te.cache/
25+
*.user
26+
*.tar.gz
27+
tarballs/
28+
test-results/
29+
Thumbs.db
30+
31+
# Mac bundle stuff
32+
*.dmg
33+
*.app
34+
35+
# resharper
36+
*_Resharper.*
37+
*.Resharper
38+
39+
# dotCover
40+
*.dotCover
41+
*.nupkg

Naxam.YYModel.iOS/ApiDefinition.cs

Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
using System;
2+
using System.ComponentModel;
3+
using Foundation;
4+
using ObjCRuntime;
5+
using YYModel;
6+
7+
namespace YYModel
8+
{
9+
// @interface YYModel (NSObject)
10+
[Category]
11+
[BaseType (typeof(NSObject))]
12+
interface NSObject_YYModel
13+
{
14+
// +(instancetype _Nullable)yy_modelWithJSON:(id _Nonnull)json;
15+
[Static]
16+
[Export("yy_modelWithJSON:")]
17+
[return: NullAllowed]
18+
[EditorBrowsable(EditorBrowsableState.Never)]
19+
NSObject Yy_modelWithJSON(NSObject json);
20+
21+
// +(instancetype _Nullable)yy_modelWithDictionary:(NSDictionary * _Nonnull)dictionary;
22+
[Static]
23+
[Export("yy_modelWithDictionary:")]
24+
[return: NullAllowed]
25+
[EditorBrowsable(EditorBrowsableState.Never)]
26+
NSObject Yy_modelWithDictionary(NSDictionary dictionary);
27+
28+
// -(BOOL)yy_modelSetWithJSON:(id _Nonnull)json;
29+
[Export ("yy_modelSetWithJSON:")]
30+
bool Yy_modelSetWithJSON (NSObject json);
31+
32+
// -(BOOL)yy_modelSetWithDictionary:(NSDictionary * _Nonnull)dic;
33+
[Export ("yy_modelSetWithDictionary:")]
34+
bool Yy_modelSetWithDictionary (NSDictionary dic);
35+
36+
// -(id _Nullable)yy_modelToJSONObject;
37+
[NullAllowed, Export ("yy_modelToJSONObject")]
38+
NSObject Yy_modelToJSONObject ();
39+
40+
// -(NSData * _Nullable)yy_modelToJSONData;
41+
[NullAllowed, Export ("yy_modelToJSONData")]
42+
NSData Yy_modelToJSONData ();
43+
44+
// -(NSString * _Nullable)yy_modelToJSONString;
45+
[NullAllowed, Export ("yy_modelToJSONString")]
46+
string Yy_modelToJSONString ();
47+
48+
// -(id _Nullable)yy_modelCopy;
49+
[NullAllowed, Export ("yy_modelCopy")]
50+
NSObject Yy_modelCopy ();
51+
52+
// -(void)yy_modelEncodeWithCoder:(NSCoder * _Nonnull)aCoder;
53+
[Export ("yy_modelEncodeWithCoder:")]
54+
void Yy_modelEncodeWithCoder (NSCoder aCoder);
55+
56+
// -(id _Nonnull)yy_modelInitWithCoder:(NSCoder * _Nonnull)aDecoder;
57+
[Export ("yy_modelInitWithCoder:")]
58+
NSObject Yy_modelInitWithCoder (NSCoder aDecoder);
59+
60+
// -(NSUInteger)yy_modelHash;
61+
[Export ("yy_modelHash")]
62+
nuint Yy_modelHash ();
63+
64+
// -(BOOL)yy_modelIsEqual:(id _Nonnull)model;
65+
[Export ("yy_modelIsEqual:")]
66+
bool Yy_modelIsEqual (NSObject model);
67+
68+
// -(NSString * _Nonnull)yy_modelDescription;
69+
[Export ("yy_modelDescription")]
70+
string Yy_modelDescription ();
71+
}
72+
73+
// @interface YYModel (NSArray)
74+
[Category]
75+
[BaseType (typeof(NSArray))]
76+
interface NSArray_YYModel
77+
{
78+
// +(NSArray * _Nullable)yy_modelArrayWithClass:(Class _Nonnull)cls json:(id _Nonnull)json;
79+
[Static]
80+
[Export ("yy_modelArrayWithClass:json:")]
81+
[return: NullAllowed]
82+
[EditorBrowsable(EditorBrowsableState.Never)]
83+
NSObject[] Yy_modelArrayWithClass (Class cls, NSObject json);
84+
}
85+
86+
// @interface YYModel (NSDictionary)
87+
[Category]
88+
[BaseType (typeof(NSDictionary))]
89+
interface NSDictionary_YYModel
90+
{
91+
// +(NSDictionary * _Nullable)yy_modelDictionaryWithClass:(Class _Nonnull)cls json:(id _Nonnull)json;
92+
[Static]
93+
[Export ("yy_modelDictionaryWithClass:json:")]
94+
[return: NullAllowed]
95+
[EditorBrowsable(EditorBrowsableState.Never)]
96+
NSDictionary Yy_modelDictionaryWithClass (Class cls, NSObject json);
97+
}
98+
99+
// @protocol YYModel <NSObject>
100+
[Protocol, Model]
101+
[BaseType (typeof(NSObject))]
102+
interface YYModel
103+
{
104+
// @optional +(NSDictionary<NSString *,id> * _Nullable)modelCustomPropertyMapper;
105+
[Static]
106+
[NullAllowed, Export ("modelCustomPropertyMapper")]
107+
NSDictionary<NSString, NSObject> ModelCustomPropertyMapper { get; }
108+
109+
// @optional +(NSDictionary<NSString *,id> * _Nullable)modelContainerPropertyGenericClass;
110+
[Static]
111+
[NullAllowed, Export ("modelContainerPropertyGenericClass")]
112+
NSDictionary<NSString, NSObject> ModelContainerPropertyGenericClass { get; }
113+
114+
// @optional +(Class _Nullable)modelCustomClassForDictionary:(NSDictionary * _Nonnull)dictionary;
115+
[Static]
116+
[Export ("modelCustomClassForDictionary:")]
117+
[return: NullAllowed]
118+
Class ModelCustomClassForDictionary (NSDictionary dictionary);
119+
120+
// @optional +(NSArray<NSString *> * _Nullable)modelPropertyBlacklist;
121+
[Static]
122+
[NullAllowed, Export ("modelPropertyBlacklist")]
123+
string[] ModelPropertyBlacklist { get; }
124+
125+
// @optional +(NSArray<NSString *> * _Nullable)modelPropertyWhitelist;
126+
[Static]
127+
[NullAllowed, Export ("modelPropertyWhitelist")]
128+
string[] ModelPropertyWhitelist { get; }
129+
130+
// @optional -(NSDictionary * _Nonnull)modelCustomWillTransformFromDictionary:(NSDictionary * _Nonnull)dic;
131+
[Export ("modelCustomWillTransformFromDictionary:")]
132+
NSDictionary ModelCustomWillTransformFromDictionary (NSDictionary dic);
133+
134+
// @optional -(BOOL)modelCustomTransformFromDictionary:(NSDictionary * _Nonnull)dic;
135+
[Export ("modelCustomTransformFromDictionary:")]
136+
bool ModelCustomTransformFromDictionary (NSDictionary dic);
137+
138+
// @optional -(BOOL)modelCustomTransformToDictionary:(NSMutableDictionary * _Nonnull)dic;
139+
[Export ("modelCustomTransformToDictionary:")]
140+
bool ModelCustomTransformToDictionary (NSMutableDictionary dic);
141+
}
142+
143+
//// @interface YYClassIvarInfo : NSObject
144+
//[BaseType (typeof(NSObject))]
145+
//interface YYClassIvarInfo
146+
//{
147+
// // @property (readonly, assign, nonatomic) Ivar _Nonnull ivar;
148+
// [Export ("ivar", ArgumentSemantic.Assign)]
149+
// unsafe Ivar Ivar { get; }
150+
151+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull name;
152+
// [Export ("name", ArgumentSemantic.Strong)]
153+
// string Name { get; }
154+
155+
// // @property (readonly, assign, nonatomic) ptrdiff_t offset;
156+
// [Export ("offset", ArgumentSemantic.Assign)]
157+
// IntPtr Offset { get; }
158+
159+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull typeEncoding;
160+
// [Export ("typeEncoding", ArgumentSemantic.Strong)]
161+
// string TypeEncoding { get; }
162+
163+
// // @property (readonly, assign, nonatomic) YYEncodingType type;
164+
// [Export ("type", ArgumentSemantic.Assign)]
165+
// YYEncodingType Type { get; }
166+
167+
// // -(instancetype _Nonnull)initWithIvar:(Ivar _Nonnull)ivar;
168+
// [Export ("initWithIvar:")]
169+
// unsafe IntPtr Constructor (Ivar* ivar);
170+
//}
171+
172+
//// @interface YYClassMethodInfo : NSObject
173+
//[BaseType (typeof(NSObject))]
174+
//interface YYClassMethodInfo
175+
//{
176+
// // @property (readonly, assign, nonatomic) Method _Nonnull method;
177+
// [Export ("method", ArgumentSemantic.Assign)]
178+
// unsafe Method* Method { get; }
179+
180+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull name;
181+
// [Export ("name", ArgumentSemantic.Strong)]
182+
// string Name { get; }
183+
184+
// // @property (readonly, assign, nonatomic) SEL _Nonnull sel;
185+
// [Export ("sel", ArgumentSemantic.Assign)]
186+
// Selector Sel { get; }
187+
188+
// // @property (readonly, assign, nonatomic) IMP _Nonnull imp;
189+
// [Export ("imp", ArgumentSemantic.Assign)]
190+
// unsafe IMP* Imp { get; }
191+
192+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull typeEncoding;
193+
// [Export ("typeEncoding", ArgumentSemantic.Strong)]
194+
// string TypeEncoding { get; }
195+
196+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull returnTypeEncoding;
197+
// [Export ("returnTypeEncoding", ArgumentSemantic.Strong)]
198+
// string ReturnTypeEncoding { get; }
199+
200+
// // @property (readonly, nonatomic, strong) NSArray<NSString *> * _Nullable argumentTypeEncodings;
201+
// [NullAllowed, Export ("argumentTypeEncodings", ArgumentSemantic.Strong)]
202+
// string[] ArgumentTypeEncodings { get; }
203+
204+
// // -(instancetype _Nonnull)initWithMethod:(Method _Nonnull)method;
205+
// [Export ("initWithMethod:")]
206+
// unsafe IntPtr Constructor (Method* method);
207+
//}
208+
209+
//// @interface YYClassPropertyInfo : NSObject
210+
//[BaseType (typeof(NSObject))]
211+
//interface YYClassPropertyInfo
212+
//{
213+
// // @property (readonly, assign, nonatomic) objc_property_t _Nonnull property;
214+
// [Export ("property", ArgumentSemantic.Assign)]
215+
// unsafe objc_property_t* Property { get; }
216+
217+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull name;
218+
// [Export ("name", ArgumentSemantic.Strong)]
219+
// string Name { get; }
220+
221+
// // @property (readonly, assign, nonatomic) YYEncodingType type;
222+
// [Export ("type", ArgumentSemantic.Assign)]
223+
// YYEncodingType Type { get; }
224+
225+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull typeEncoding;
226+
// [Export ("typeEncoding", ArgumentSemantic.Strong)]
227+
// string TypeEncoding { get; }
228+
229+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull ivarName;
230+
// [Export ("ivarName", ArgumentSemantic.Strong)]
231+
// string IvarName { get; }
232+
233+
// // @property (readonly, assign, nonatomic) Class _Nullable cls;
234+
// [NullAllowed, Export ("cls", ArgumentSemantic.Assign)]
235+
// Class Cls { get; }
236+
237+
// // @property (readonly, nonatomic, strong) NSArray<NSString *> * _Nullable protocols;
238+
// [NullAllowed, Export ("protocols", ArgumentSemantic.Strong)]
239+
// string[] Protocols { get; }
240+
241+
// // @property (readonly, assign, nonatomic) SEL _Nonnull getter;
242+
// [Export ("getter", ArgumentSemantic.Assign)]
243+
// Selector Getter { get; }
244+
245+
// // @property (readonly, assign, nonatomic) SEL _Nonnull setter;
246+
// [Export ("setter", ArgumentSemantic.Assign)]
247+
// Selector Setter { get; }
248+
249+
// // -(instancetype _Nonnull)initWithProperty:(objc_property_t _Nonnull)property;
250+
// [Export ("initWithProperty:")]
251+
// unsafe IntPtr Constructor (objc_property_t* property);
252+
//}
253+
254+
//// @interface YYClassInfo : NSObject
255+
//[BaseType (typeof(NSObject))]
256+
//interface YYClassInfo
257+
//{
258+
// // @property (readonly, assign, nonatomic) Class _Nonnull cls;
259+
// [Export ("cls", ArgumentSemantic.Assign)]
260+
// Class Cls { get; }
261+
262+
// // @property (readonly, assign, nonatomic) Class _Nullable superCls;
263+
// [NullAllowed, Export ("superCls", ArgumentSemantic.Assign)]
264+
// Class SuperCls { get; }
265+
266+
// // @property (readonly, assign, nonatomic) Class _Nullable metaCls;
267+
// [NullAllowed, Export ("metaCls", ArgumentSemantic.Assign)]
268+
// Class MetaCls { get; }
269+
270+
// // @property (readonly, nonatomic) BOOL isMeta;
271+
// [Export ("isMeta")]
272+
// bool IsMeta { get; }
273+
274+
// // @property (readonly, nonatomic, strong) NSString * _Nonnull name;
275+
// [Export ("name", ArgumentSemantic.Strong)]
276+
// string Name { get; }
277+
278+
// // @property (readonly, nonatomic, strong) YYClassInfo * _Nullable superClassInfo;
279+
// [NullAllowed, Export ("superClassInfo", ArgumentSemantic.Strong)]
280+
// YYClassInfo SuperClassInfo { get; }
281+
282+
// // @property (readonly, nonatomic, strong) NSDictionary<NSString *,YYClassIvarInfo *> * _Nullable ivarInfos;
283+
// [NullAllowed, Export ("ivarInfos", ArgumentSemantic.Strong)]
284+
// NSDictionary<NSString, YYClassIvarInfo> IvarInfos { get; }
285+
286+
// // @property (readonly, nonatomic, strong) NSDictionary<NSString *,YYClassMethodInfo *> * _Nullable methodInfos;
287+
// [NullAllowed, Export ("methodInfos", ArgumentSemantic.Strong)]
288+
// NSDictionary<NSString, YYClassMethodInfo> MethodInfos { get; }
289+
290+
// // @property (readonly, nonatomic, strong) NSDictionary<NSString *,YYClassPropertyInfo *> * _Nullable propertyInfos;
291+
// [NullAllowed, Export ("propertyInfos", ArgumentSemantic.Strong)]
292+
// NSDictionary<NSString, YYClassPropertyInfo> PropertyInfos { get; }
293+
294+
// // -(void)setNeedUpdate;
295+
// [Export ("setNeedUpdate")]
296+
// void SetNeedUpdate ();
297+
298+
// // -(BOOL)needUpdate;
299+
// [Export ("needUpdate")]
300+
// bool NeedUpdate { get; }
301+
302+
// // +(instancetype _Nullable)classInfoWithClass:(Class _Nonnull)cls;
303+
// [Static]
304+
// [Export ("classInfoWithClass:")]
305+
// [return: NullAllowed]
306+
// YYClassInfo ClassInfoWithClass (Class cls);
307+
308+
// // +(instancetype _Nullable)classInfoWithClassName:(NSString * _Nonnull)className;
309+
// [Static]
310+
// [Export ("classInfoWithClassName:")]
311+
// [return: NullAllowed]
312+
// YYClassInfo ClassInfoWithClassName (string className);
313+
//}
314+
315+
// [Static]
316+
// [Verify (ConstantsInterfaceAssociation)]
317+
// partial interface Constants
318+
// {
319+
// // extern double YYModelVersionNumber;
320+
// [Field ("YYModelVersionNumber", "__Internal")]
321+
// double YYModelVersionNumber { get; }
322+
323+
// // extern const unsigned char [] YYModelVersionString;
324+
// [Field ("YYModelVersionString", "__Internal")]
325+
// byte[] YYModelVersionString { get; }
326+
// }
327+
}

0 commit comments

Comments
 (0)