title: Saving custom object as core data property
body: <p>I am trying to save a custom class as a property of a core data object.</p>
  
  <p>The Core Data object:</p>
  
  <pre><code>@objc(Safer)
  class Safer: NSObject
  {
  @NSManaged var perakimFiles: [prayer]? //This line gives me an error saying that it cannot save a type that is not Obj. C
  @NSManaged var titleEnglish: String?
  @NSManaged var titleHebrew: String?
  @NSManaged var parshaPerakim: [Int]?
  @NSManaged var saferCode: String?
  var titles: [[String]]
  {
      get
      {
          var ret = [[String]]()
          var i = 0
          for file in perakimFiles!
          {
              ret.append([file.title, "\(i+1)"])
              i++
          }
          return ret
      }
  }
  
  init(_ _saferCode: SefarimCodes)
  {
      super.init()
      self.saferCode = _saferCode.rawValue
  }
  
  init(_perakimFiles: [prayer], _titleEnglish: String, _titleHebrew: String)
  {
      super.init()
      self.perakimFiles = _perakimFiles
      self.titleEnglish = _titleEnglish
      self.titleHebrew = _titleHebrew
  }
  init(_perakimFiles: [prayer], _titleEnglish: String, _titleHebrew: String, _parshaPerakim: [Int])
  {
      super.init()
      self.perakimFiles = _perakimFiles
      self.titleEnglish = _titleEnglish
      self.titleHebrew = _titleHebrew
      self.parshaPerakim = _parshaPerakim
      self.saferCode = setTorahSaferCode()!.rawValue
      let config = self.configFromCode()
      self.perakimFiles = config.perakimFiles
  }
  }
  </code></pre>
  
  <p>Here is the prayer class that I am trying to save in the core data object:</p>
  
  <pre><code>class prayer
  {
  var url: NSURL
  var title: String
  var detail: String?
  
  init(initURL: NSURL, initTitle: String)
  {
      print("1")
      print("2")
      self.title = initTitle
      print("3")
      self.url = initURL
      print("4")
  }
  
  init(initURL: NSURL, initTitle: String, initDetail: String)
  {
      self.url = initURL
      self.title = initTitle
      self.detail = initTitle
  }
  }
  </code></pre>
  
  <p>So what can I do to the prayer class to make it savable by the core data object? I need to also be able to use instances of the prayer class in other places of the code.</p>