dduan / Just

Swift HTTP for Humans
MIT License
1.4k stars 134 forks source link

swift4, xcode 9.2 errors #101

Closed gaming-hacker closed 6 years ago

gaming-hacker commented 6 years ago

hi, i get the following errors

Cannot convert return expression of type 'Dictionary<Key, Value>.Values' to return type 'LazyMapCollection<[Key : Value], Value>'

lines 330-333

  public var keys: LazyMapCollection<[Key : Value], Key> {
    return _data.keys
  }
  public var values: LazyMapCollection<[Key : Value], Value> {
    return _data.values
  }

i didn't see the "values" being used anywhere?? i commented out the lines and checked a couple of files and servers and got back the correct GET/POST

goribchat commented 6 years ago

is Just supported for swift 4.0?

juzhizhang commented 6 years ago
public var keys:Dictionary<Key,Value>.Keys {
return _data.keys

} public var values:Dictionary <Key,Value>.Values { return _data.values }

change, is ok!

olferuk commented 6 years ago

@juzhizhang create a PR with relevant changes, please.

goribchat commented 6 years ago

This is my response message. here is my code let params = ["username" : email, "password": password] as [String : Any] Just.post(Constant.url.login1,params: params) { (r) in if !r.ok { print(r.text!)

    }
    else{

        let json = r.text!
        print(json)
        let login = Mapper<UserRoot>().map(JSONString: json)
        let errorValue = login?.success
        self.userDetails1 =  login?.details
        DispatchQueue.main.async {
            if errorValue == true {
                self.userDetails1.backup = self.passwordTF.text!
                self.passwordTF.text = ""
            }
            else if errorValue == false {

            }
        }
    }
but after giving proper login credentials it is showing that username password is wrong. please help..
gaming-hacker commented 6 years ago

check to see if you have synced the thread back on the main thread and update the gui

goribchat commented 6 years ago

Okay Thanks