Writing Xcode plugin in Swift
I’ve found myself using Xcode a lot more than I did in Objective-C.
One of things I’ve missed a lot from my AppCode setup, is the ability to jump to specific file & line that logged a console message.
Because Xcode doesn’t offer such functionality and because I do not like to complain, I’ve decided to write my own plugin for it.
I wrote it in Swift.
The beauty of imperfection
Perfection is not something one can truly achieve, so it’s very smart that one of the best meditation services called Headspace is using an imperfect dot as their brand logo.
If you ever used their iOS app, you can notice how their dot slightly deforms, captivating your focus.
When it comes to graphics, if you are able to cheat (if user can’t tell the difference) and make tech stuff easier, just do it.
With Swift strong typing and immutability, there are rules that prevent you from accesing variables until an object is fully initialized.
I do not like having a function do more than one thing, so I like to split my initializers into multiple functions, this becomes problematic.
Tips for Interface Builder
Young developers are happy when they write a lot of code, they like to brag about that project that has tens of thousands lines of code they wrote.
As we get more experienced, we realize that code is expensive. It’s expensive to maintain, debug and reason about.
That’s why we should aim to use tools that can help us avoid writing boilerplate code, one of those tools is Interface Builder.
Here are a few of my favourite tips & tricks.
Prototyping floating burger menu with CAShapeLayer
Reproducing above effect is very simple with CAShapeLayer and CoreAnimation…
Simple way to scrape web with Ruby
MyFitnessPal didn’t give me API access, so I wrote some Ruby to get it anyway.
Playgrounds for Objective C
Playgrounds are one of the niftiest features of Swift.
They allow you to quickly test out bits of code and see results in real time without going through the traditional edit-compile-run-debug cycle.
“But surely playgrounds aren’t possible in Objective-C?” you say… Think again.
- Faster than Swift playgrounds (a lot)
- Extra controls for tweaking:
- Adjustable values
- Autoanimated values
- IDE agnostic, once you run it, you can modify the code even from vim.
- Full iOS simulator and access to all iOS features, so you can prototype production ready code.
- Nice DSL for rapid prototyping
- CocoaPods support, so you can add it to existing projects to experiment
- Open source, anyone can contribute to make them better!
Source code on GitHub
iOS Project Bootstrap
If you are looking for some good quality project settings and scripts, I’ve open-sources my bootstrap for upcoming 2015.
Check it out on github.
How do I work?
I’ve been programming for 20 years now, doing commercial work for the last 8.
Over the years I’ve been exposed to different ideas and experiences that have constantly affected the way I work.
What matters and how I go about working for my clients?
A Swift introduction into fitness
Many people think getting fit is hard, the fitness industry is full of myths and unnecessary complications.
Doesn’t matter if your goal is to lose weight or gain it, what matter is Physics and law of energy:
If you burn more calories than you eat you will lose weight
Two questions arise:
- how to estimate our caloric needs?
- how fast should we lose or gain weight?
We’ll use Swift Playgrounds to explain it.