Skyscanner / SkyFloatingLabelTextField

A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.
Apache License 2.0
4.09k stars 542 forks source link

Swift4.2 update #238

Closed Michele404 closed 6 years ago

Michele404 commented 6 years ago

Update to 4.2 please

k0nserv commented 6 years ago

Hey @Michele404 there's a PR open https://github.com/Skyscanner/SkyFloatingLabelTextField/pull/236 that needs a few more fixes before it can be merged.

k0nserv commented 6 years ago

I've just released 3.6.0 which supports Swift 4.2

newmanw commented 5 years ago

Still getting a warning in xcode to convert to Swift 4.2 when trying to use version 3.6.0.

screen shot 2019-01-28 at 10 11 37 am

k0nserv commented 5 years ago

Super odd... It should be fine and the syntax is 4.2 compatible. It still compiles I assume?

newmanw commented 5 years ago

After a little more research it looks like xcode is really bad at recognizing when multiple versions of swift are supported:

screen shot 2019-01-28 at 10 16 39 am

Is there any way to "force" xcode to ignore this type of thing, would be nice not to have the "you need to update your swift projects warning"

k0nserv commented 5 years ago

We can set swift_version in the podspec, but if you do that I believe the pod will stop working for other versions. Might be worth looking through the CocoaPod issues? It should be possible to write a post_install hook in your Podfile to change the SWIFT_VERSION build setting for the target

k0nserv commented 5 years ago

Try

post_install do |installer|
  installer.pods_project.targets.each do |pod_target|
    pod_target.build_configurations.each do |config|
      if pod_target.name == 'SkyFloatingLabelTextField'
        config.build_settings['SWIFT_VERSION'] = '4.2'
      end
    end
  end
end
newmanw commented 5 years ago

My swift version is already set to 4.2. This still doesn't prevent xcode from seeing code that is not compat (the code in your else statement) with swift 4.2 and thinking it needs to be converted. Since that code will not run its not a big deal, just more fun with swift and xcode.

k0nserv commented 5 years ago

And even forcing the target to 4.2 doesn't make Xcode stop warning?

newmanw commented 5 years ago

Correct. Xcode is picking up code that is not compat with 4.2 and it wants to update that code.

k0nserv commented 5 years ago

That sucks :( Don't think there's anything we can do then