AutocompleteTextfieldSwift icon indicating copy to clipboard operation
AutocompleteTextfieldSwift copied to clipboard

Swift 3.0 ?

Open sourabhsharmait opened this issue 9 years ago • 8 comments

Update to Latest Syntax please....

sourabhsharmait avatar Oct 12 '16 11:10 sourabhsharmait

I can't get it to work with Swift 3. Has anyone been succesful?

SvshX avatar Nov 16 '16 12:11 SvshX

Yes

On 16-Nov-2016 5:48 pm, "Sascha Melcher" [email protected] wrote:

I can't get it to work with Swift 3. Has anyone been succesful?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mnbayan/AutocompleteTextfieldSwift/issues/46#issuecomment-260932349, or mute the thread https://github.com/notifications/unsubscribe-auth/ALifp1rNaGuoIJ_zZq4urxhUJ6rF-o3Lks5q-vR3gaJpZM4KUqaL .

sourabhsharmait avatar Nov 18 '16 18:11 sourabhsharmait

Could you please help me with it?

SvshX avatar Nov 18 '16 18:11 SvshX

Yes i will but on monday

On 19-Nov-2016 12:10 am, "Sascha Melcher" [email protected] wrote:

Could you please help me with it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mnbayan/AutocompleteTextfieldSwift/issues/46#issuecomment-261607784, or mute the thread https://github.com/notifications/unsubscribe-auth/ALifp3b3MahueNWvjp-pYWE6mRw9-Osbks5q_fEJgaJpZM4KUqaL .

sourabhsharmait avatar Nov 18 '16 19:11 sourabhsharmait

Thanks! My main issue is in the fetchAutoCompletePlaces function. The url for Google Places API cannot be used like in Swift 2 anymore. Now I'm using this but it shows STATUS: "unable to read data":

let urlString = "\(baseURLString)?key=\(googleMapsKey)&input=\(keyword)" let s = NSMutableCharacterSet() //create an empty mutable set s.formUnion(with: NSCharacterSet.urlQueryAllowed) // let s = NSCharacterSet.URLQueryAllowedCharacterSet.mutableCopy() as! NSMutableCharacterSet s.addCharacters(in: "+&") if let encodedString = urlString.addingPercentEncoding(withAllowedCharacters: s as CharacterSet) {

SvshX avatar Nov 19 '16 19:11 SvshX

How did you make it work on Swift 3?

magonicolas avatar Dec 22 '16 13:12 magonicolas

It worked fine for me, but at first didn't compile.

In the fetchAutoCompletePlaces function, change: let result = try JSONSerialization.jsonObject(with: data, options: .allowFragments) to let result = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as! Dictionary<String,Any>

mloupe avatar Dec 27 '16 21:12 mloupe

Thanks @mloupe that did the job!

magonicolas avatar Jan 03 '17 13:01 magonicolas