How UIPushBehavior instantaneous mode works

Today I worked with UIKit Dynamics for implementing some physical based UI effects. It’s the first time I use it, I was really impressed how easy it is to bring awesome physical UI effects in your app. Usually physical engines only available in games, but it’s really cool that Apple brings this kind of technology to iOS environment just for building UI.

While I was using it, there is one thing that confused me. That’s UIPushBehavior’s instantaneous mode. For UIPushBehavior’s another mode continuous, it says very clearly in the document

...

read the full article

UICollectionView invalid number of items crash problem and solution

Recently, I am working on an iOS project that has an UICollectionView in it. For updating items in the collection, I wrote code like this

collectionView.performBatchUpdates({
    for update in updates {
        switch update {
        case .Add(let index):
            collectionView.insertItemsAtIndexPaths([NSIndexPath(forItem: index, inSection: 0)])
        case .Delete(let index):
            collectionView.deleteItemsAtIndexPaths([NSIndexPath(forItem: index, inSection: 0)])
        }
    }
}, completion: nil)

Basically, whenever the data source updates the items, it runs this piece of code to insert or delete items in the UICollectionView. The code looks pretty straightforward, but sometimes it crashes. The exception looks like this

...

read the full article

MVVM with ReactiveCocoa 4 - Why and How (part 1)

I started GUI programming with Visual Basic 6.0, then I learned how to use Microsoft MFC with C++, a while later I switched to Python and working with wxPython, which is a Python port for wxWidget. It has been more than ten years since I started working on GUI software. Recently I started working on iOS / OS X App projects in Swift, and interestingly I found that the essentials of building GUI apps are not changing too much, so are the problems I’ve been seeing so far. Despite we are still facing the same problems for developing GUI app, the good thing about software technology is that the solutions always improve over time, there is always new things to learn.

...

read the full article

Anonymous computing: Peer-to-peer encryption with Ember.js

Bugbuzz is an online debugger, one of my pet projects. What I wanted to provide is kind of really easy-to-use debugging experience, I envisioned the debugging with it should be like dropping one line as what you usuallly do with ipdb or pdb.

import bugbuzz; bugbuzz.set_trace()

You can do it anywhere, no matter it’s on your Macbook or it’s on server. Then there comes a fancy Ember.js based online debugging UI.

...

read the full article