Manbolo Blog

Manbolo Team Blog, creators of MeonArchives

Code Beautifier in Xcode

Among various things, what I love about Python is that the style / formatting of Python code is "standardized", PEP 8 giving strong coding conventions that every (sane) Python developer follows with love. One of Guido’s key insights is that code is read much more often than it is written, so it’s important that your code is readable and consistent, particularly when you’re working in team. Go goes even further, with gofmt a tool that automatically standardize indentation, spacing and other details of code.

Objective-C is also heavily conventionalised: in Apple developer library, you can find Coding Guidelines for Cocoa, but this document is mainly about naming conventions. If you’re an experienced Objective-C developer, chances are good that your functions, methods and class names will be the same as another Objective-C developer one’s (for instance, very few chances to have a method named -get_app_id:(NSString *)id, instead of -applicationForIdentifier:(NSString *)identifier).

But there are no strong conventions (at least from Apple) about how to format your code: spaces vs tabs, if-then-else braces style, parameters and operators formatting etc… Moreover, code formatting in Xcode (as Xcode 6.3.1) is quite limited. You can select your code and re-indent it (Editor > Structure > Re-Indent or ctrl+I), but you’ve very few possibilities to customize the formatting rules.

Ultimately, what you want to do is having your code automatically formatted, following guidelines that you’ve defined in team and apply. Fortunately, Xcode can be easily extended for source code processing, as we’ve seen in our last post Extend Xcode with Text Services. In this post, I’ll show you two possibilities for formatting your code to your needs.

1. clang-format

clang-format is a command-line tool to format C/C++/Obj-C code. clang-format formats the code from standard input and writes the result to the standard output.

Instead of having hundreds of configuration options, clang-format has built-in styles:

You can base your clang-format configuration on these predefined style guides, and overrides some style options (see the complete list here).

clang-format will search for a configuration file (named either .clang-format or _clang-format) in the folder of the source file, or recursively in the parent folder until it find a configuration file (this way, you can commit a configuration file to the root folder of your source project and have it shared by the whole team for a given project).

An example of such configuration file:

# We’ll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 4
Language: Cpp
# Force pointers to the type for C++.
DerivePointerAlignment: false
PointerAlignment: Left
Language: JavaScript
# Use 100 columns for JS.
ColumnLimit: 100
Language: Proto
# Don’t format .proto files.
DisableFormat: true

We’ve seen how to write text services in Automator to extend Xcode text features. Now, we can use this method to write a service that will take text selection as input, and replace with it formatted output,

First, we need to install clang-format on our system. The easiest way is using Homebrew:

$ brew install clang-format

Then, we’re going to write a text services that will use clang-format to format a text selection:

  1. Launch Automator, click on ’Services’, then ’Choose’
  2. Select ’Run Shell Script’ from the Library
  3. In the shell script box, write this command:

    export PATH=/usr/local/bin:$PATH
  4. Select ’Output replaces selected text’ and save under the name ’clang-format’
  5. Create a .clang-format file in your home directory and write your options. For instance:

    # We’ll use defaults from the LLVM style, but with 4 columns indentation.
    BasedOnStyle: LLVM
    IndentWidth: 4  

Now, select some code in Xcode, right-click and select clang-format:

If you prefer, you can specify your options style directly in the workflow (instead of relying on the .clang-format file in your home):

    clang-format -style="{IndentWidth: 4, TabWidth: 4, UseTab: Never,   BreakBeforeBraces: Stroustrup}"

clang-format is very promising, and easy to use. There are a limited set of configurable options, the downside is that it might not suit your style well. For instance, configuring the breaking braces is either Linux, Stroustrup, Allman or GNU, period. If you find clang-format not enough configurable, you can use another solution, like uncrustify.

Note: you can easily create a default .clang-format file if you need to see all the default options:

clang-format -style=llvm -dump-config > .clang-format 

2. uncrustify

uncrustify is another source code beautifier, but contrary to clang-format, it’s highly configurable (454 configurable options as of version 0.60). The documentation is quite limited, you will need to find what your want in the latest configuration file on GitHub. But you will be able to create a style that suit you perfectly.

The simplest way to configure uncrustify is to have a configuration file named .uncrustify.cfg in your home directory. You will find some examples of configuration files on the uncrustify GitHub repo, but my best advise is to start with an empty configuration file, and add option one by one, by testing the output (uncrustify specific options to Objective-C contains _oc_ in the name, like sp_after_oc_scope, sp_after_oc_return_type etc…)

As with clang-format, we can write a service that will take text selection as input and replace with it formatted output,

First, we need to install uncrustify on our system. The easiest way is using Homebrew:

$ brew install uncrustify

Then, we’re going to write a text services that will use uncrustify to format a text selection:

  1. Launch Automator, click on ’Services’, then ’Choose’
  2. Select ’Run Shell Script’ from the Library
  3. In the shell script box, write this command:

    export PATH=/usr/local/bin:$PATH
    uncrustify -l oc
  4. Select ’Output replaces selected text’ and save under the name ’uncrustify’
  5. Create a .uncrustify.cfg file in your home directory and write your options. For instance:

    # The number of columns to indent per level.
    # Usually 2, 3, 4, or 8.
    indent_columns = 4        # number
    # How to use tabs when indenting code
    # 0=spaces only 
    # 1=indent with tabs to brace level, align with spaces
    # 2=indent and align with tabs, using spaces when not on a tabstop
    indent_with_tabs = 0        # number
    # Add or remove space around assignment operator ’=’, ’+=’, etc
    sp_assign = force   # ignore/add/remove/force

Now, select some code in Xcode, right-click and select uncrustify.

That’s all folks!

From jc.

Extend Xcode with Text Services

Extend Xcode with customized scripts is really easy thanks to Services. WWDC 2012 session 402, Working Efficiently with Xcode, shows how to integrate a bash script in Xcode Services menu to sort and uniq headers imports in your Objective-C file.

  1. Launch Automator, click on ’Services’, then ’Choose’:

    This creates a new service that takes a text selection from any application and replaces the selection with its output.

  2. Select ’Run Shell Script’ from the Library (you can filter actions by name, for instance ’Run’) and drag it to the right window (your service workflow):

  3. In the shell script box, put this command:

    sort -f | uniq

    Select ’Output replaces selected text’ and save under the name ’Sort and Uniq’ (this will create a file called ’Sort and Uniq.workflow’ under ~/Services/). You can see that this service will receive selected text as input from any application and will replace the selection with its output.

  4. Now, open an implementation file in Xcode, select your headers imports, right click and go to ’Services’ then ’Sort and Uniq’. Et voilà!

This service will be available on text selection from any application. This shows you how easily you can integrate custom scripts, thanks to the venerable text services of OS X.

From jc.

Samsung Xpress M2875FW / AirPrint iOS 8 Compatibility Issues

After upgrading to iOS 8, I’ve unpleasantly discovered that I couldn’t print from any iOS 8 devices on my beloved Samsung Xpress M2875FW. With Yosemite, AirPrint works flawlessly; with iOS 7 devices, AirPrint works fine; with my iPhone 5C on iOS 8.1, AirPrint just reboots my printer.

The iOS 8 AirPrint issues seems not confined to the Samsung M2875FW printer: HP Deskjet 2540 and 4620, Samsung CLX-3305 FW, Epson WF3520 series, Canon MG5450 etc… A lot of printers still referenced on Apple Air Print official pages have been broken by iOS 8. Sad, and certainly a bad sign after the iOS 8 / iOS 8.0.1 general quality issues.

Thanks to the Apple Support Communities and particularly arathorn357, I’ve been able to make my printer works again with iOS 8.1.

These steps apply for the Samsung Xpress M2875FW, but if you’ve any AirPrint issues on iOS 8, you can try these:

  1. Upgrade with the last firmware from Samsung Xpress M2875FW: click on Firmware, download the Firmware File (Firmware) (ver.V3.xx.01.27) for Mac OS and install it on your printer.
  2. On the devices, from System Preferences / Wi-Fi, select ’Forget this Network’ option to lose the Wi-Fi connection.
  3. Re-boot the devices to let the OS load from a shutdown then a cold start.
  4. Re-establish a connection for each device to the Wi-Fi you want to use from System Preferences again.
  5. Shut down the printer at the power switch and then power it up again.
  6. Re-connect the printer to the same Wi-Fi network.
  7. Then try printing using AirPrint from an iOS 8 device.

It works for me, it could work for you. If you still have issues, try these other suggestions.

From jc.

Xcode 6 Auto Layout Margin Annoyances

warning: Attribute Unavailable: Layout attributes relative to the layout margin on iOS versions prior to 8.0

Xcode 6.0.1 (6A317)

If you’re annoyed when settings Auto Layout constraints margins with Xcode 6 in Interface Builder, (NSLayoutAttributeLeftMargin, NSLayoutAttributeRightMargin, NSLayoutAttributeTopMargin, NSLayoutAttribute*Margin etc…), just click on the Option key ⌥ to switch to the standard iOS 7 mode (i.e. without margin).

Time saver!

From jc.

Use Python Effectively on OS X

This post is an unorganised collection of notes about how I use Python effectively on OS X. Disclaimer: I don’t pretend to be a Python expert, by a far mesure, so there could be some Pythonic horrors in this article; if you think so, just drop us a mail, and we’ll update this article.

TL&DR: don’t use the pre-installed OS X Python. Use Python with Homebrew. Never ever sudo pip. Use virtualenv / virtualenvwrapper. PyCharm worth the price. Python rocks.

  1. OS X default Python installation
  2. Installing brew
  3. Installing Python 2.7 with brew
  4. Installing third-party libraries
  5. Shell scripts with Python
  6. Must-have packages
  7. Python 3
  8. IDEs on OS X
  9. Various tools

1. OS X default Python installation

A quick word about the default Python installation. Python comes pre-installed on OS X. If you open a terminal, and simply ask for the location of the python binary, you will see:

$ which python

Launching the interpreter in a terminal window:

$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

So Python 2.7.5 is the default python interpreter. If you need to, Python 2.6.8 and Python 2.5.6 are also available on a vanilla OS X.

Simply use python2.6 for Python 2.6.8:

$ python2.6
Python 2.6.8 (unknown, Mar  9 2014, 22:16:00)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

And python2.5 for Python 2.5.6:

$ python2.5
Python 2.5.6 (r256:Unversioned directory, Mar  9 2014, 22:15:03)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

While it can be convenient to have a pre-installed Python, my rookie advise is to not use it: Apple doesn’t always do a good job on keeping the Python runtime environment up to date, plus it can be cumbersome to play with permissions just to install third-party Python librairies, and finally, Apple has a tendency to wipe-out your site-packages with every major OS upgrade.

So I simply recommend to install Python aside the default one, with Homebrew. You’ll never have to use sudo or have permissions problem; if you have any issues, you can drop /usr/local and start from fresh without having messed up your OS X system. Let’s do it now!

2. Installing brew

There are many package installers on OS X but I find Homebrew very pleasant, simple and convenient. Homebrew, originally started by Max Howell, simplify the installation of open source tools (like ImageMagick, wget, ag etc..) that are not by default on OS X.

What I really like with Homebrew is that everything is installed in a directory that is not conflicting with the system directories. By default, it’s on /usr/local but you can change to whatever you like.

Installing Homebrew is very simple: open a Terminal window and type

ruby -e "$(curl -fsSL"

3. Installing Python 2.7 with brew

Now that our Homebrew installation is done, we can install Python. We’re going to start by installing Python 2.7:

$ brew install python

Now, we need to tell the system to use our freshly new Python interpreter instead of the default one.

$ which python

The default Python interpreter is under /usr/bin, and the Homebrew’s one is under /usr/local/bin so we’re going to edit /etc/paths so the /usr/local/bin binaries will be prioritised over /usr/bin.

$ sudo vi /etc/paths

If you open /etc/paths, you should see this:


Move /usr/local/bin at the beginning of the file so Homebrew binaries take on system binaries;


Finally, check everything is ok: typing python should launch the Homebrew version

$ source /etc/paths
$ which python

$ python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

pip has been also installed alongside our brewed Python; pip will allow us to easily install and manage Python packages.

$ which pip

With this setup (brewed python), you’ll NEVER have to use sudo to install any Python relative stuff. If you end up doing this, something is broken in your brewed Python installation.

4. Installing third-party libraries

4.1. Essential

There are two kind of third-party libraries: those you want to be installed anytime with your default Python, and those you like to play with, or use only for your toys projects. You don’t want to mess your default Python, so I recommend to install only the essential libraries in your default Python (which is /usr/bin/local/python if you’ve followed my previous advices).

Those essentials libraries depends on your needs, and will be different from one person to another. In Must-have packages, I’ve listed some open source packages that I found convenient to be always present in my system.

You’ll be able to install the other libraries in a virtual Python environment, that could be used and / or trash anytime, without messing up your brewed installation.

Let’s take the example of a library that I want to always be available in my Python interpreter: Requests. To install it, I simply pip install request in a terminal window. This way, each time I use my default Python, I can do HTTP requests really easily.

$ pip install requests

$ python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__path__

4.2. virtualenv

Now, you could theoretically install all the third parties libraries you need in your default Python. But, imagine you have a script that needs version 1 of LibFoo, but another script requires version 2. How can you use both these scripts? If you install everything into /usr/local/lib/python2.7/site-packages/, it’s easy to end up in a situation where you unintentionally upgrade something that shouldn’t be upgraded.

Or more generally, what if you want to install an application and leave it be? If an application works, any change in its libraries or the versions of those libraries can break the application.

To address this, we’re going to use virtualenv. virtualenv allows you to create an optimised, independent and sandboxed copy of your default Python. You’ll be able to install packages in this virtual Python environment, and only in this environnement. You will be able to use this Python interpreter (or activate it), play with it, and comes back (deactivate) to the default environnement. You will be able to have multiple venvs (shortcut for virtual Python environment), each one being completely independent of the others; you will be able to switch between environment, execute periodic scripts in a given environment etc…

To install virtualenv, just use your default pip:

pip install virtualenv

Example: you want to play with latest version of Django. So the first step is to create a venv for the latest version of Django. You can create a venv anywhere on your disk, and you do not need to be root to do this, you just need write permissions. For example, you can install a new venv in your Documents directory:

$ cd ~/Documents
$ virtualenv -p /usr/local/bin/python2.7 venv-django

This command has created a sandboxed version of your Python environment under the folder venv-django. By default, this copy comes clean, without the third-party packages that are installed in your default Python. This allows you to start from a clean, new state. You can open the folder ~/Documents/venv-django and you will see a sandboxed Python environment:

$ cd ~/Documents/venv-django
$ ls -l
total 0
drwxr-xr-x  19 jc  staff  646 Sep 27 11:43 bin
drwxr-xr-x   3 jc  staff  102 Sep 27 11:43 include
drwxr-xr-x   3 jc  staff  102 Sep 27 11:43 lib
$ cd bin
$ ls -l
total 160
-rw-r--r--  1 jc  staff   2203 Sep 27 11:43 activate
-rw-r--r--  1 jc  staff   1259 Sep 27 11:43 activate.csh
-rw-r--r--  1 jc  staff   2472 Sep 27 11:43
-rw-r--r--  1 jc  staff   1129 Sep 27 11:43
-rwxr-xr-x  1 jc  staff    253 Sep 27 11:43 easy_install
-rwxr-xr-x  1 jc  staff    253 Sep 27 11:43 easy_install-2.7
-rwxr-xr-x  1 jc  staff    150 Sep 27 11:43 get_env_details
-rwxr-xr-x  1 jc  staff    225 Sep 27 11:43 pip
-rwxr-xr-x  1 jc  staff    225 Sep 27 11:43 pip2
-rwxr-xr-x  1 jc  staff    225 Sep 27 11:43 pip2.7
-rw-r--r--  1 jc  staff     72 Sep 27 11:43 postactivate
-rw-r--r--  1 jc  staff     74 Sep 27 11:43 postdeactivate
-rwxr-xr-x  1 jc  staff     69 Sep 27 11:43 preactivate
-rw-r--r--  1 jc  staff     75 Sep 27 11:43 predeactivate
lrwxr-xr-x  1 jc  staff      9 Sep 27 11:43 python -> python2.7
lrwxr-xr-x  1 jc  staff      9 Sep 27 11:43 python2 -> python2.7
-rwxr-xr-x  1 jc  staff  12744 Sep 27 11:43 python2.7

A new python interpreter is here and ready to serve! But currently the Python interpreter is still the default one.

$ which python

To switch to the interpreter of the venv, you need to activate it. source the bin/activate script that have been created in the venv folder:

$ source ~/Documents/venv-django/bin/activate

(venv-django)$ which python 

(venv-django)$ which pip

You can see that your shell prompt is now prefixed with the name of the current activated environment (very convenient). You can test that no third-party packages have been installed and that your virtual env is clean:

(venv-django)$ python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named requests

You can use this new Python environment without fearing to break anything, or to bloat you default Python. activate simply add the virtual env Python binaries to your PATH, in front of system defined binaries. Each time we’ll use pip or python, we’ll use the ones that are in this sandbox.

Now, we can safely install Django in your new environment:

(venv-django)$ pip install django
(venv-django)$ python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django

To leave the current virtualenv, and go back to the default Python, just type deactivate in any path.

$(venv-django) deactivate   

Back to the default Python, Django is not installed and everything is clear.

You don’t need to do the activate/deactivate dance each time you want to use a particular venv. Let’s say you want to execute a cron task is using a virtual env defined at ~/Documents/venvs/myvenv. You can use the venv python interpreter to launch (without calling activate), and everything will just works, your script will be able to import any module defined in your venv:

$ ~/Documents/venvs/myvenv/bin/python

4.3. virtualenvwrapper

Working with multiple virtualenv can become really teddy and cumbersome: you have to switch and remember where is located the venv you want to use. This is where virtualenvwrapper comes to place: virtualenvwrapper is a set of extensions to virtualenv tool. You can easily list, create and delete virtual environments; all of your virtual environments are organized in one place.

Installing virtualenv is really simple, with your main Python:

pip install virtualenvwrapper

Next, you have to add source /usr/local/bin/ to your shell startup file (on OS X, you can put this at the end of ~/.bash_profile).

Then, everything is set up and you can create a new venv:

$ mkvirtualenv env1
New python executable in env1/bin/python2.7
Also creating executable in env1/bin/python
Installing setuptools, pip…done.
(env1)~ $

By default, all your virtual environments will be created under ~/.virtualenvs/ but you can change it.

List all environnement:

$ workon

Switch on environnement env1:

$ workon env1

5. Shell scripts with Python

If you write shell scripts in Python, you can launch your script by simply call:

$ python

This will execute your script, with the current python interpreter. If your script need a particular virtual environnement to run, you can run it in this virtual environment without having to activate it before. Simply hard code the python interpreter binary that ways:

$ /Users/jc/.virtualenvs/env1/bin/python

This will execute the script in the virtual environnement defined at /Users/jc/.virtualenvs/env1. All the packages that you have installed in this virtual environnement will be callable in the script.

If you want to call directly your script without typing python, add the proper permission on your script

$ chmod u+x

And add the following shebang at the beginning of your script:

#!/usr/bin/env python

You can also point to a particular python interpreter if you want:


Which is considerably less portable. #!/usr/bin/env python will use the current python interpreter of your shell session (which can be a virtualenv ones).

Finally, it’s a best practice to declare the encoding of your script file. On OS X, use UTF-8.

For example, the following script:

#!/usr/bin/env python

if __name__ == ’__main__’:
    print("Hello こんにちは!")

will produced this error when executed:

File "./", line 5
SyntaxError: Non-ASCII character ’\xe3’ in file ./ on line 5, but no encoding declared; see for details

With the proper encoding hint, everything works as it should be (you can even use emojis if you want!):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == ’__main__’:
    print("Hello こんにちは!")

$ ./
Hello こんにちは!

6. Must-have packages

I’m not a Python expert, and everyone’s needs are different so take this list with a grain of salt.

If you want to do web development, you could try:

Flask and Bottle are both excellent. Give both a try before deciding which one to use.

7. Python 3

Everything I’ve just said works for Python 2 or Python 3. Python 3 doesn’t come pre-installed on OS X, so if you want to install it, just use brew.

brew install python3

Then you can launch python3 and play with the new asyncio module:

$ python3
Python 3.4.1 (default, May 19 2014, 13:10:29)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio

Python 2 and Python 3 can coexist without any problem. If you want to launch the Python 2 interpreter, just use python. If you want to use the Python 3 interpreter, just use python3; if you want to install packages in Python 2 library, just use pip, if you want to install packages in your Python 3 library, just use pip3….et voilà!!!.

You can create virtual env that will use Python 2 or Python 3, just use the -p option flag to target a specific Python. For instance:

mkvirtualenv -p /usr/local/bin/python3 testasyncio

Will construct a venv with Python 3.

8. IDEs on OS X

You can write Python code with vim but there are good and complete Python IDEs on OS X.

9. Various tools

9.1. Fabric

Fabric is a command-line tool for streamlining the use of SSH for application deployment or systems administration tasks. I use it for deploying this blog from my Mac for instance. With Fabric, you can launch command as if you were on your server, and execute arbitrary Python functions via the command line.

For exemple, in a file you code:

from fabric.api import local

def prepare_deploy():
    local("./ test my_app")
    local("git add -p && git commit")
    local("git push")

And then on the command line, you can launch:

$ fab prepare_deploy

And the commands will be executed locally.

But the real power of Fabric it that it can run commands on your server, from your Mac! For instance:

env.hosts = [’’]

def deploy():
    code_dir = ’/srv/django/myproject’
    with cd(code_dir):
        run("git pull")
        run("touch app.wsgi")

If you execute fab deploy, the commands will be sent from your Mac to your server (via SSH) and executed here! Fabric really simplify you deployment needs and you can deploy, run scripts on multiple servers easily. I use it to deploy the blog on our server, and we use it also to deploy our various Django projects.

From jc.

Joli Originals iPhone 6 Cases Available for Pre-Order NOW

In the midsts of all the Apple craziness, Jolien & Harold have announced new iPhone 6 cases available for pre-order NOW!

Joli Originals makes beautiful, handmade sleeves, from smooth premium Italian leather, with superb colors. They’re taking pre-order now for their iPhone 6 / iPhone 6 Plus model, and will start shipping the pre-orders on Monday the 22nd.


From jc.

Faux App, Analyze your Xcode Projects

What the Clang Static Analyzer is to your code, Faux Pas is to your whole Xcode project.

Faux Pas is an OS X application to inspect and check possible issues and bugs in your Xcode projects. From the features list:

Faux Pas is not only highly configurable and simple, but it also helps you to learn and enforce best practices on your code. I already use the Clang Static Analyser in combination with Jenkins, and I’m looking forward to integrate Faux Pas in our continuous integration build server.

A must for iOS / OS X devs!

From jc.

Castle of Illusion Starring Mickey Mouse

Castle of Illusion Starring Mickey Mouse is undoubtedly the best game I’ve ever played on iOS. The graphics are astonishing, musics are exceptional (use a headphone), and the gameplay is very good. I’m having so much fun playing it, it’s simply an exceptionally excellent game. A lot of love has been put in the development of this game; currently at $0.99, it’s a no-brainer, GET IT NOW!! It will comes back at $9.99 soon (even at that price, I still recommend it!)…

I have never liked the virtual gamepad used in some iOS games, but in Castle of Illusion, the virtual joystick just works. You will need good controls because the challenge is not easy. Besides, iOS 7 game controller support remains a promise unfulfilled promisses and a missed opportunity for Apple (anyone knows a good bluetooth game controller?). It’s also a real joy to play to a long, classic game, without any single one app purchase. A relief. Castle of allusion is also available on Android, but I’ve not tested it.

Like Zelda : A Link Between Worlds, the game is not just a HD remake of Castle of Illusion on Sega Genesis / Mega Drive, but a completely and reinvented game. Sega may have disappeared from hardware business, but I’m happy to see that they still have a future as games editor. And Sega and Disney seems to works nicely together (remember QuackShot?)

When I see this level of quality in iOS games, I fear for Nintendo.

Castle of Illusion screenshotAll graphics are now in beautiful, colourful 3D

Castle of Illusion screenshotMickey in the Cloud

Castle of Illusion screenshot

Castle of Illusion screenshotThe Castle

Castle of Illusion screenshot

Castle of Illusion screenshotYou first boss, a friendly old tree!

Castle of Illusion screenshot

Castle of Illusion screenshot

Castle of Illusion screenshotOne of the many puzzles: through the looking-glass

Castle of Illusion screenshotAnother boss!

Castle of Illusion screenshot

Castle of Illusion screenshotMiam miam, a sea of maccarons

Castle of Illusion screenshotThe green diamond is over here!

Castle of Illusion screenshot

Castle of Illusion screenshotA marshmallow dragoon!

Castle of Illusion screenshotHow cute are these littles sugars!

Castle of Illusion screenshot

Castle of Illusion screenshot

Castle of Illusion screenshotUnder the water, the vestige of an ancient city

Castle of Illusion screenshot

From jc.

Samsung Xpress M2875FW, a Really Good and Affordable AirPrint Laser Printer

Updated on 2014/02/11: The Samsung Xpress M2875FW can have compatibility issues with iOS 8. If you’re not able to print from an iOS 8 device, try the suggestions in Samsung Xpress M2875FW / AirPrint iOS 8 Compatibility Issues, it has worked for me.

If you’re looking for a good AirPrint laser printer and affordable, the Samsung Xpress M2875FW is for you. There are a lot of cheap AirPrint inkjets, but due to the price of ink cartridges, I have been looking for a good laser printer.

My wish list was:

After a lot of researches, I’ve found a printer that answers to each point of my wish list: the Samsung Xpress M2875FW. The Samsung Xpress M2875FW is an affordable (currently $189.99 on Amazon, subject to price change) multi-function printer, with AirPrint support, duplex printing and relatively small (15.8 x 14.3 x 14.4 inches / 40.3 x 36.3 x 36.6 cm):

Samsung Xpress M2875FW

When doing my researches, I tried to find how good was the support of AirPrint for each possible printer. I wanted to be able to have a built-in support, and I discarded any printer that allow printing only from a third party app. If you want to be sure that you future printer will support AirPrint out-of-the-box, my advise is to check this official list of AirPrint printers by Apple.

The Amazon page of the M2875FW indicates that there is a newer model, the M2885FW, but as this newer model was not listed on the Apple AirPrint support page, I have preferred to try and buy the M2875FW. The printer has been really easy to setup (on my MacBook Pro on Mavericks), you just have to launch the Samsung install CD and follow the instructions for AirPrint. Once the printer is installed on the MacBook Pro, printing from any iPhone or iPad is immediate, with no-setup. It’s kind of magic (like all the other Air technologies, AirDrop and AirPlay).

I’m really happy with my new printer and can’t recommend it enough. The only minus point is the cost of Samsung toners, that are above the average laser toners (around 10c / page); on the other hand, the M2875FW has an eco mode, but I haven’t finished a full toner to check the real cost.

Buy the M2875FW on Amazon - affiliated link

From jc.

Testing on iOS / OSX: There Is an Apple Framework for That

The new issue of is about Testing. Really a good new issue with a lot of interesting stuff. Being in the iOS development since 5-6 years, I’ve seen testing to be taken more and more seriously, if not by third parties, certainly by Apple.

But, man, 8 articles on testing on iOS, and not only one mention of UIAutomation, the core Apple framework for UI testing… Really?

If you want more information on UIAutomation (now spelled UI Automation by Apple), I recommend you the top read article on our blog iOS Automated Tests with UIAutomation. It’s a little dated, but I think it’s still a good base for learning UIAutomation.

What I love about UIAutomation is that it depends on accessibility: to be able to test your user interface, you have to make it accessible. So clever!

iOS Automated Tests with UIAutomation

Launching UIAutomation Tests in Command Line

Automated Static Code Analysis with Xcode 5.1 and Jenkins

From jc.

Import Cheetah3D Model in SceneKit

This article is really for 3D rookies like me that would like to play with SceneKit. SceneKit[1] is a high-level 3D framework, introduced in Mountain Lion, that allows reading, manipulating and displaying 3D scenes. SceneKit is now part of iOS, starting from iOS 8, allowing developers to easily integrate 3D graphics or develop 3D casual games on iPhone / iPad / iOther.

SceneKit supports the import of COLLADA scenes: COLLADA is an open XML file format for 3D assets, supported by a lot (if not all) 3D creation softwares (like Blender, Maya, Bryce etc…). If you’re new to 3D and just want to play with SceneKit, you can search for free COLLADA files on the web (*.dae), or use the ones included in Apple SceneKit samples (Vehicle, Bananas, or even the complete WWDC 2014 SceneKit session, available as a sample code!)

Besides using free models, you can also create your own using a 3D modelling tool: there are plenty of choices from free (Blender) to very expensive (Maya). On the mac, Cheetah3D is really an excellent, and not very expensive, alternative. For $69, you have a complete 3D modelling, rendering and animation software for OSX (buy directly on Cheetah3D web site or on the Mac App Store).

I’m just beginning to use Cheetah3D, and I really appreciate how easy is the creation of 3D models. Cheetah3D is also a native Cocoa app, with an intuitive, Macintosh-like user interface:

Cheetah3DCheetah3D on Mavericks.

Really a great software!

I’ve created this mug in a couple of minutes, following the first tutorial of Learn 3D with Cheetah3D 6, an excellent resource on Cheetah3D. To include this model in an iOS sample app, we need to first export it as a COLLADA file from Cheetah3D. Select File > Export, choose dae as File Format and save your file (or download it here).

Then, create a SceneKit sample, with Xcode 6: New Project > Single View Application.

SceneKit sample step 1

Give it a product name:

SceneKit sample step 2

Select the main storyboard of the document, Main.storyboard , then the ViewController scene, and remove the default view of the ViewController.

SceneKit sample step 3

Now, in the right corner of Xcode, select the Object library (as in the screenshot), and drag and drop a SceneKit view on the view controller.

SceneKit sample step 4

Now, some code! Open ViewController.m and add the following code:

@import SceneKit;
@implementation ViewController
- (void)viewDidLoad
    [super viewDidLoad];

    SCNView *myView = (SCNView *)self.view;
    myView.scene = [SCNScene sceneNamed:@"mug.dae"];
    myView.allowsCameraControl = YES;
    myView.autoenablesDefaultLighting = YES;
    myView.backgroundColor = [UIColor lightGrayColor];

We’ve just loaded our mug COLLADA file into the 3D scene view. Now, we need to import the file into our project: File > Add Files to "TestSK" and select our our mug.dae file. Then build and run:

SceneKit sample step 5

Mmmm… Something must be missing, we don’t have any textures displayed in the simulator! In fact, we forget something really important when importing our COLLADA files from Cheetah3D. In COLLADA files, textures are referenced and not included in the file; in other terms, the mug.dae file is not sufficient, and must be accompanied by the textures files that it references. So, we just need to include our mug-diffuse.png texture in our project: File > Add Files to "TestSK" and select the mug-diffuse.png file. Before running again the sample, you can select the mug.dae file in Xcode, and check that everything looks good now:

SceneKit sample step 6

Then, run the sample, et voilà !

iOS SimulatorThe mug in the iOS simulator

More on SceneKit

WWDC 2012 - Session 504: Introducing Scene Kit

WWDC 2013 - Session 500: What’s New in Scene Kit

WWDC 2014 - Session 609: What’s New in SceneKit

WWDC 2014 - Session 610: Building a Game with SceneKit

From jc.

  1. Spelled "Scene Kit" on Mountain Lion and Mavericks, and "SceneKit" on iOS 8 / OSX Yosemite 

All Posts

襄阳棋牌 正规斗地主赢现金 斗牛游戏大全软件 宏丰棋牌手机版 AG棋牌乐 绑定支付宝送3金币棋牌 斗地主赢钱50元提现 炸金花赢钱的小方法 最好的捕鱼游戏排名 手机上拼三张技巧 网上赌三公软件 金蟾捕鱼技巧 富宏棋牌 捕鱼游戏可以换现金的 最赚钱的斗地主游戏 单机无限金币炸金花 手机炸金花赢现金 炸金花平台游戏 扑克牛牛玩法 大亨棋牌 有没有能用花呗的棋牌 斗牛牛真人版app 50元斗地主提现版 能挣钱的捕鱼游戏 手机砸金花平台 牵手游戏棋牌 华尔娱乐 牛牛棋牌现金游戏手游 千炮捕鱼游戏下载免费 斗牛捕鱼能提现棋牌