Skip to main content

Tech

Updating Xcode plug-ins

5 min read

I recently saw Joe's post about updating Xcode plug-ins, but since I'm really lazy, updating them one by one didn't suffice, so here's my take on it. In case you want to skip straight to the desert, here's the gist.

First, we change our script's directory:

# You might need these.
# require 'pathname'
# require 'fileutils'
Continue reading →

Reusing blocks of code

1 min read

Let's say you have a method which performs some networking actions, which can obviously fail, but in different ways:

func performNetworkStuff() {
  fetchSomething(then: { condition in
    if condition {
      
    }
    // failure due to condition
    else {
      failureAction1()
      failureAction2()
      variable1 = value
      etc...
    }
  }) {
    // failure due to network
    failureAction1()
    failureAction2()
    variable1 = value
    etc...
  }
}

But instead, we could DRY it up a little bit, by storing the failure actions into a block beforehand:

Continue reading →

Code coverage issues for Swift projects

2 min read

I stumbled upon a problem recently (the full story can be found on Apple Developer Forums) and the short version is: running the app or the tests without code coverage enabled always worked fine, but turning it on caused errors to appear, breaking the build process when trying to test.

Hunting attemp #75. One of the errors raised was Segmentation fault 11, which appeared for several Swift files during the Compile Swift source files phase. This is an error I remembered having in the early days of Swift when writing daring short syntax, like:

Continue reading →

Wrapping up the Pull Request from terminal

2 min read

You might want to read the the first part and the second part, too.

During the weekend I rewrote a lot of the script, covering cases where the Pull Request failed, adding Fastlane automation and all around improvements.

The script has now 2 possible parameters, a different branch than development, and skip_deploy, in case we don't want to auto-run the fastlane command. Comments explaining the flow, as usual:

Continue reading →

Improving the Pull Request from terminal

1 min read

Just a slight improvement for last post: sometimes I don't have the branch pushed on GitHub, so why not automate that too?

perform_pull_request() {
  branch="development"
  branch_to_push="$(parse_git_branch)"
  git push origin "$branch_to_push":"$branch_to_push"
 
  if [ -n "$1" ]; then
    branch=$1
  fi
 
  pr_url=$(hub pull-request -b "$branch" -m "$(formatted_git_branch)")
 
  if [ $? -eq 0 ]; then
    open "$pr_url"
  fi
}
 

I also found some nice helpers for easier color printing:

Continue reading →

Safari's new pinned tab feature

A really interesting thing I noticed is that if you open a link inside a pinned tab, it will open a new one, with an active back button, which if pressed, will close the newly created tab and focusing the parent pinned tab again.

I haven't found a way to disable this behavior, but I personally like it.

Xcode 7 crash analysis tools

45 sec read

I saw this gem the other day and I think it's awesome!

One of the only downsides is that you can't import crash logs, but you can (kinda) export the existing ones, if you want to see them in Hockey's Crash Browser, for example: Right click on a crash → Show in Finder → right click on the file (should be an xccrashpoint file) → Show Package Contents → DistributionInfosallLogs → here you can find all the crash logs related to that specific crash (apparently several are grouped into a crash-group).

Searchable WWDC videos

25 sec read

You can now search for keywords within WWDC videos.

Now it's easier to discover and share information presented in WWDC videos with our recent search update. You can search a keyword and find all the instances of it mentioned in the videos. Go straight to the time the keyword was mentioned in the video or easily share a link to it. Try it out.