• Reviving Shopster - AutoLayout

    I’m trying to revive Shopster, an app we launched 2013, and I’m writing througout the process. If this is the first post you see, you can start here.

    Shopster uses Storyboards. I like them and can say I was an early adopter of them. Now with Storyboard references, I think they are even better and simpler to use.

    As I wrote before, our app only supported 4 inch phones (iPhone 5 / 5s / 5c / SE), and was not written using Auto Layout. So my next step is to enable AutoLayout and fix the layout of every screen.

    Luckily, the app has about 8 screens total, so that should not be too hard.

  • Writing Unit Tests in Swift for Objective-C Projects

    As I wrote previously, I decided to write my (missing) unit tests for an old Objective-C app in Swift.

    Immediately after starting, I run into an issue: I can’t import the Swift module on the test target. All the settings appear to be correct: I’m defining a module, including a bridging header. However, whenever I import my module on Swift I get an error.

    The only workaround I could find, was to include a Swift file in the Objective-C project. I’m not sure what dark magic this triggers in Xcode 8, but it makes the trick.

    Here’s in all its glory, Dummy.swift:

    import Foundation
    // This file is not used at all on the project, but triggers Xcode to properly
    // create the module for testing purposes. ¯\_(ツ)_/¯
  • Reviving Shopster - Testing in Swift

    I’m trying to revive Shopster, an app we launched 2013, and I’m writing througout the process. If this is the first post you see, you can start here.

    When I mentioned the pile of technical debt in Shopster, I neglected to say that it doesn’t have any unit nor UI tests1.

    Now, with lots of changes to be done to fix deprecations, it’s one of those times when you regret not having those tests that give you the confidence to move forward with the changes.

    So with a better late than never attitude, I created a test target on the project with a slight twist: I’ll write all the tests in Swift. This is a low friction place to start adding Swift to the codebase, without rewriting nor having to deal with too much interop. I’m pretty sure that as soon as I add new classes to the app, those will be Swift as well, but I haven’t hit that yet.

    1. Even though I talked about it during an NSConf Argentina! 

  • Reviving Shopster - Deprecations and iOS 10

    A nice thing about reviving a project, is that I get to choose the target platform again. In this case, I don’t see a reason not to make it iOS 10 only: up until iOS 9, the app worked (even if it was not optimized for), so users of iOS 9 can remain on the old version.

    This gives me the chance of remove a lot of old stuff that I had laying around, mainly to support older OS versions.

  • Reviving Shopster - Baseline Metrics

    Before any change to the codebase (apart for making it build), I figure it’s a good idea to have a baseline of the amount of code the app has. For that, I’ll use cloc. Here’s the initial output:

         127 text files.
         127 unique files.                                          
          25 files ignored.
    github.com/AlDanial/cloc v 1.70  T=0.74 s (137.4 files/s, 8946.6 lines/s)
    Language                     files          blank        comment           code
    Objective C                     47           1200            493           3688
    C/C++ Header                    53            296            372            476
    JSON                             2              0              0            117
    SUM:                           102           1496            865           4281

    This was run only on the folder where our code resides, so it’s excluding all external dependencies (basically, the Pods folder).