jsonswiftswifty-jsonhaneke

Haneke crashing SwiftyJSON's 'JSON?' type


I have a TableViewCell that works just fine. However as soon as I import Haneke, I receive error on var post: JSON? {.. :

'JSON' is ambigious for type lookup in this context

import UIKit
import SwiftyJSON
// import Haneke

class DiscoverTableViewCell: UITableViewCell {

    var post: JSON? {
        didSet {
            self.setupPost()
        }
    }

What am I doing wrong?

By the way, I am using pod

pod 'Alamofire', '~> 3.0' pod 'SwiftyJSON', '~> 2.2' pod 'HanekeSwift'

This is how I declare it in TableViewController:

  import Alamofire
  import SwiftyJSON

  var results: [JSON]? = []      // SwiftyJSON's [JSON]

  func smt() {
       ...
       let json = JSON(response.result.value!)

       if let data = json["data"].arrayValue as [JSON]? {
               self.results = data
        }

Solution

  • There can be same typealias.

    You can use SwiftyJson like this:

    let json = SwiftyJSON.JSON(response.result.value!)
    let result = Haneke.AnyFunction()