0

i am facing issue with create table in DBObject (DBAccess ORM) with declare bool type and Int type field, and also i am not able to declare "description" filed.

//Swift Code:-

import UIKit

@objc(Circlelist)

class Circlelist: DBObject {

dynamic var name : String!;
dynamic var group_id : NSNumber!;
dynamic var group_id : Int!;   //Getting issue here
dynamic var desc : String!;
dynamic var description : String!; //Getting issue here
dynamic var address : String!;
dynamic var latitude : String!;
dynamic var longitude : String!;
var isdeleted : Bool = false;    //Getting issue here

}

When i wright "dynamic var isdeleted : Bool!;" at that time give error like "Property cannot be marked dynamic because its type cannot be represented in Objective-C".

dynamic var isdeleted : Bool!

and when i wright "dynamic var isdeleted : Bool;" at that time give error like "Class circle list has no initialiser".

dynamic var isdeleted : Bool

Please suggest me perfect solution to know how to fix this issue, give details about DataType and more information about DBAccess.

AtulParmar
  • 4,358
  • 1
  • 24
  • 45

1 Answers1

0

You don't specify what issues you are getting exactly, but some of them I can guess.

dynamic var description : String!;

description is a method name on Objective-C classes, so it is a reserved word. The compiler is warning you of this.

dynamic var group_id : Int!;

Int! is not a supported type in Obj-C, as the compiler error is telling you. So you will need to use NSNumber.

var isdeleted : Bool = false;

I'm not clear what the issue might be, except the absence of the dynamic keyword to indicate it's persistence.

See this SO article to see a list of supported Objective-C types.

DBAccess: long long value supprted or not?

If you have more information about the issues you are having then please add it and we will try to help further.

Community
  • 1
  • 1
Adrian_H
  • 1,548
  • 1
  • 14
  • 27
  • Hi Adrian_H..!!.. Thanks for your feedback. When i wright "dynamic var isdeleted : Bool!;" at that time give error like "Property cannot be marked dynamic because its type cannot be represented in Objective-C" and when i wright "dynamic var isdeleted : Bool;" at that time give error like Class circle list has no initialiser. Please give your feedback. – AtulParmar May 04 '16 at 14:13
  • If you remove the "!" and assign it a default value it will be compatible with ObjC. ```dynamic var isdeleted : Bool = false```, DBAccess will then replace it's value when read from the tables. You will then no longer get the compilation errors about your class missing initialisers. – Adrian_H May 04 '16 at 14:47