xi-editor / xi-mac

The xi-editor mac frontend.
Apache License 2.0
3.02k stars 147 forks source link

update to swift 5 #461

Closed cmyr closed 5 years ago

cmyr commented 5 years ago

Swift 5 is now out, and we should look into migrating.

This should probably be painless, but there are a few places where we should be careful; in particular the places where we currently convert utf8 offsets to utf16 offsets; I haven't looked too closely at the new String api in swift, but there should be some way to use utf8 offsets directly.

nangtrongvuon commented 5 years ago

From what I've experienced with Swift 5, many of its changes are already available if you compile under Xcode 10.2, so there shouldn't be a lot of breaking changes, but I'm wary. I'll still do a quick runthrough of everything and try to get to updating xi-mac this next week (since I'm kind of stuck with family business at the moment).

mmatoszko commented 5 years ago

Swift 5 changed the string encoding from UTF-16 to UTF-8. Since core uses UTF-8 for the RPC, I think we might get away with just removing the conversions from and to UTF-16 🤔

cmyr commented 5 years ago

@mmatoszko That's my hope, but I'd want to test it; it may be that certain API are still expecting indicies to be utf-16 code units? Really not sure. So... 🤞

jeremywiebe commented 5 years ago

One thing to note about this upgrade. When we do, some folks who are using older versions of Xcode will no longer be able to compile the app (because this will necessarily require Xcode 10.2).

Xcode 10.2 requires macOS 10.14.3 which I think is a reason some folks haven't upgraded Xcode yet.

I'm fine with this, but raising it as a concern that might affect others. :)

nangtrongvuon commented 5 years ago

That's definitely a good reason to consider. I think some people here uses High Sierra still, which doesn't have Xcode 10.2 IIRC.

mmatoszko commented 5 years ago

Do you think we're free to migrate to Swift 4.2 right now? Currently we're at 4.0

cmyr commented 5 years ago

We could, but is it much advantage over just going straight to 5?

mmatoszko commented 5 years ago

There are some minor things which need to be resolved in order to go for Swift 4.2 which we could tackle very soon, bc it does not require an update to Mojave.

Swift 5 could happen right after that 😄

cmyr commented 5 years ago

Ah gotcha. Yea, I'd be happy to review going to 4.2.