Skip to content

Commit 213ed18

Browse files
committed
- further fix on the nullability
- spacing issue fixed on @Property
1 parent 1dead48 commit 213ed18

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Templates/ObjC/Base/SharedObjC.template.tt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,20 @@ private string GetStaticBaseObject()
241241

242242
private string GeneratePropertyDeclarationLine(OdcmProperty prop)
243243
{
244-
if(prop.IsNullable==true)
244+
if(prop.IsCollection || prop.IsComplex())
245245
{
246-
return "@property (nullable, nonatomic, setter=" + GetObjCPropertySetter(prop) + ":, getter=" + GetObjCPropertyGetter(prop) + ") " + GetObjCTypeForVarDeclaration(prop) + " " + GetObjCProperty(prop) + ";";
246+
if(prop.IsNullable==true)
247+
{
248+
return "@property (nullable, nonatomic, setter=" + GetObjCPropertySetter(prop) + ":, getter=" + GetObjCPropertyGetter(prop) + ") " + GetObjCTypeForVarDeclaration(prop) + " " + GetObjCProperty(prop) + ";";
249+
}
250+
else
251+
{
252+
return "@property (nonnull, nonatomic, setter=" + GetObjCPropertySetter(prop) + ":, getter=" + GetObjCPropertyGetter(prop) + ") " + GetObjCTypeForVarDeclaration(prop) + " " + GetObjCProperty(prop) + ";";
253+
}
247254
}
248255
else
249256
{
250-
return "@property (nonnull, nonatomic, setter=" + GetObjCPropertySetter(prop) + ":, getter=" + GetObjCPropertyGetter(prop) + ") " + GetObjCTypeForVarDeclaration(prop) + " " + GetObjCProperty(prop) + ";";
257+
return "@property (nonatomic, setter=" + GetObjCPropertySetter(prop) + ":, getter=" + GetObjCPropertyGetter(prop) + ") " + GetObjCTypeForVarDeclaration(prop) + " " + GetObjCProperty(prop) + ";";
251258
}
252259
}
253260

Templates/ObjC/Models/ComplexType.h.tt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ var baseEntity = entity.Base;
1515
<#
1616
foreach(var prop in entity.Properties.Where(prop => GetObjCTypeIdentifier(prop)!="NSStream" ))
1717
{
18-
#>
19-
<#=GeneratePropertyDeclarationLine(prop)#>
20-
<#
18+
#>
19+
<#=GeneratePropertyDeclarationLine(prop)#>
20+
<#
2121
}
2222

2323
#>

Templates/ObjC/Models/EntityType.h.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ IEnumerable<string> extraClasses = null;
1717
if (baseEntity == null)
1818
{
1919
#>
20-
@property (nonatomic, setter=setODataType:, getter=oDataType) NSString *oDataType;
20+
@property (nullable, nonatomic, setter=setODataType:, getter=oDataType) NSString *oDataType;
2121
<#
2222
}
2323

0 commit comments

Comments
 (0)