Checker v1.2: Direct Dependency Analysis

Nov 13, 2016

I have just released Checker v1.2. What is new? Not so much this time but useful nonetheless.

  • Direct Dependency Analysis now classifies each result. The classification is done by color coding: Red indicates a critical/bad issue, orange indicates a warning and green indicates good classes/files. White has no special meaning at the moment.
  • Faster is better and that is why Checker is now fully asynchronous. This means that even reading files from disk, building the dependency graph etc. is now done asynchronously with the full speed. I have tested Checker with a large Swift app and it works great.

Download Checker v.1.2

Feedback & hate mail goes to: kienle.christian@icloud.com


Direct Dependency Analysis


Download Checker v.1.2


Checker v1.1: Direct Dependency Analysis

Nov 9, 2016

I have just released Checker v1.1. What is new? A lot.

  • Direct Dependency Analysis allows you to quickly find dependency hotspots in your code.
  • Faster is better and that is why this update improves Checker’s performance by 4x.
  • An automatic version check is performed after each launch so that you get future updates as fast as possible.
  • Minor UI changes for the better: Sheets are used instead of plain modal windows.

Download Checker v.1.1

Feedback & hate mail goes to: kienle.christian@icloud.com


Direct Dependency Analysis

Direct Dependency Analysis

Direct dependency analysis tells you - for each Swift file:

  1. the number of files it directly depends on,
  2. the number of files which depend on it and
  3. the ratio between the two former numbers.

So how to get the most out of a direct dependency analysis?

Try to find files which have a high numbers and a ratio around 1.0. Why are those files special? Well: High numbers mean that a file has a lot of dependencies and that the file is also a dependency for a lot of other files. Those files tend to contain very complex stuff.


Download Checker v.1.1


Bold: A SQLite framework written in Swift

Oct 30, 2016

I do like SQLite a lot. Because of that I wrote a litte SQLite framework when Swift came out - in order to learn Swift. This little framework is called Bold. I have always it up to date. During the last few weeks I have used it myself in a private project. During the last couple of days I added a few nice little features that I like but first things first:

Checkout Bold at GitHub

One of the cool features are asynchronous transactions. They work like this:

let db = Database(URL:":memory:")
db.open()

db.async { transaction in 
  let args = ["firstName" : "Christian", 
              "lastName" : "Kienle"]
              
  let query = "INSERT INTO Person (firstName, lastName) " +
              "VALUES (:firstName, :lastName)"
              
  db.update(query, arguments: args)
  // call transaction.rollback() to perform a rollback
}

Cool isn’t it? I have also added subscripting support to the Row-structure:

let result = db.query(query: "SELECT firstName, lastName FROM Person")
for row in result {
    let firstName = row["firstName"].string
    let lastName = row["lastName"].string
    
    println("firstName: \(firstName)")
    println("lastName: \(lastName)")
}
// The result is automatically closed after a complete iteration.

Checkout Bold at GitHub

Circular dependencies: Beta 2 available

Oct 28, 2016

To make it short: Next beta is available.

Checker Integration

Dependency analysis reports view:

Dependency analysis reports view

Circular dependencies are visualised like this:

Checker Report


Download Checker - Beta

Detecting circular Dependencies in Swift code (Beta)

Oct 22, 2016

Most of the time circular dependencies are bad. You usually don’t want to have them. During the last couple of days I developed a small tool which finds circular dependencies in Swift code. It is not perfect but it works pretty well already. The tool finds circular dependencies between Swift files. You use the tool by integrating it into your Xcode build process. Once integrated the tool analyses your project every time you build it. The tool has to run while you work in Xcode.

Checker Integration

Circular dependencies are visualised like this:

Checker Report

You can click on the Swift icon to jump directly to the corresponding file. By default the most complex circular dependency is displayed immediately once the analyser has done it’s job. Use the popup menu to navigate to the other circular dependencies.

Limitations

  • In rare cases circular dependencies are reported incorrectly. I am working on fixing that.
  • Circular dependencies are reported more than once. For example: If A depends on B which depends on C which depends on A creates 6 circular dependencies.
    • A → B → C; C → A
    • A → B; B → C → A
    • C → A → B; B → C
    • etc. This will be fixed by only reporting the most complex circular dependency and by ignoring smaller circular dependencies which are just a subset of a complex one.

Download Checker - Beta