Using an Undeclared Object Type

This is so strange. Usually I could understand that the class is not declared, but it claims that the class of the object itself is not declared. NSObject works, but as my project is set up, I need it to be a clean Swift Object. My class title is as follows:

import UIKit import Foundation class Person: Object { 

I know that the foundation is really not needed, I just added it because I was not sure that it caused me problems. The problem arises both in real projects and in playgrounds, as well as in Xcode 6 and the latest version of Xcode 7 with Swift 2.0

+6
source share
4 answers

Just remove : Object . Pure Swift classes do not need to inherit from a superclass

+10
source

if you use Realm and then import

 import RealmSwift 

Full class syntax.

 import UIKit import RealmSwift class User: Object { } 
+10
source

A Pure Swift object does not inherit from a superclass:

class Person {}

You can read Classes and Structures

+4
source

Faced the same problem when working with the kingdom.

You should write:

 import Foundation import UIKit import RealmSwift class Person: Object { } 
0
source

All Articles