csexton / captured-mac

Captured
http://www.capturedapp.com
MIT License
5 stars 1 forks source link

Convert to Swift 5 #59

Closed fletchto99 closed 4 years ago

fletchto99 commented 5 years ago

👋 Hey! In my attempt to implement https://github.com/csexton/captured-mac/issues/58 I quickly realized that this app was quite out of date and is going to require some work moving it over to Swift 4.

I'll pre-face this with I have zero swift experience so please feel free to say if I've done something extremely wrong

The first major hurdle was that some 2 of the 4 dependencies from Carthage were out of date and don't support Swift 4.2. Thankfully each of these dependencies had open (and working) PRs which update the libraries to 4.2. Unfortunately, these libraries aren't really being actively maintained thus I resorted to using submodules to build the project. I've created a workspace (I hope this was the right way?) to manage these dependencies.

Now that I managed to get dependencies building I'm able to attempt to build the project without it complaining about missing headers and whatnot. Unfortunately that's when I ran into this:

Screen Shot 2019-05-16 at 9 53 22 PM

I'm going to do my best to poke at these issues over the next few weeks and hopefully get this project ported over to Swift 4. Unfoturntalty, as I had mentioned earlier, my swift knowledge is next to 0 so this may prove to be more difficult than I'm anticipating.

/cc @juliancheal Thanks for your work in https://github.com/csexton/captured-mac/pull/53 - I based my branch off of yours! /cc @csexton FYI, feel free to chime in along the way :)

fletchto99 commented 5 years ago

In the journey of moving towards submodules for dependencies, I noticed that vendor/StartAtLoginController was listed as a submodule but there was no .gitmodules file specifying any repo. I'm not sure if this is dated/removed code? For now, I've removed it so that submodules would pull correctly.

csexton commented 5 years ago

In the journey of moving towards submodules for dependencies, I noticed that vendor/StartAtLoginController was listed as a submodule but there was no .gitmodules file specifying any repo.

Heh. That was a weird artifact left over from (counts on fingers) over 3 years ago. See #24 if you are curious. Thanks for deleting it.

csexton commented 5 years ago

Unfortunately, these libraries aren't really being actively maintained thus I resorted to using submodules to build the project.

It might be better to vendor them for now, especially if we think the libraries are unmaintained. I was thinking we might want to check them in, add to the project directly, then work on migrating away to supported libraries. I imagine this would happen after upgrade to the latest swift is finished.

313 Errors

😳 That is daunting. I imagine it will be the same few things over and over -- I hope to carve out some time to help with that effort.

fletchto99 commented 5 years ago

It might be better to vendor them for now

It looks like Locksmith was the only truly unmaintained library. I'm now using github.com/stephanheilner/Locksmith on the Swift_5.0 branch (which also compiles for target 4.2). The rest appear to have updates. However, Just is no longer maintained for Carthage. It looks like, aside from locksmith, they're all maintained via Cocoapods but I'll be honest I struggled getting Cocoapods working which is why I went the submodule route.

I also noticed Swift 5 is out. I wonder if it would be worth making the jump from 3 to 5 without 4.2 in the middle? Are you by chance familiar with the latest versions (4.2 and 5)?

😳 That is daunting.

My plan is to fix the easy ones which Xcode mostly auto-fixes over the next week or so and then look at the more complex issues later. I think for the most part quite a few things just required dropping the NS... e.g. NSURL -> URL.

fletchto99 commented 5 years ago

@csexton I fixed a ton of errors. I've got it down to about 50 or so compilation errors now. I was wondering if you could look into the remaining errors? Most of them I wasn't able to figure out without RTFM. If you're familiar with swift 4 I'm hoping they shouldn't be too difficult. If you're unable to get them working then I can read up on them :)

fletchto99 commented 5 years ago

abdf632 changes the target to Swift 5 instead. Since the libs are compatible and there weren't actually any more errors I figured it would be worth building against the latest version of swift. Feel free to revert.

fletchto99 commented 4 years ago

Hey @csexton - I was wondering if this is something you might still be interested in? I think I've reached a point where I'm not much use without really understanding more about swift. I took a look at it again this past weekend but really didn't get too far.

csexton commented 4 years ago

I am still interested, but haven't had a chance to look at it. Been working in languages other than Swift recently so the context switching is hard to overcome. So, not sure when I'd get back to it. 😞

fletchto99 commented 4 years ago

I'm going to close this out for now since I haven't had time to work on it.

csexton commented 4 years ago

You and me both 😢 I hope to find some time to invest in this. Thanks for the first pass.