tech

Python Decorator

When refactoring a codes, we need to extract duplicated features from different methods or functions. A magic in Python 3 is to decorate the a striped basic functions with sharing features.

NSTableView automatically adjust height to fit cell view

Reference: Using auto-layout to calculate table cell height In ‘Using auto-layout to calculate table cell height’, it’s introduced how to use auto-layout to update table view’s (UITableView) cell height with Objective-C language.

Make text table view(NSTableView) auto resize

To make a iMessage-like chat table view, there is several steps to follow: Text field should be able to adjust its size automatically. Image view of bubble should adjust automatically relative to text field.

Add 3rd part dynamic library (.dylib) to Xcode target

Dynamic library (with .dylib suffix at UNIX-like OS) is a kind of library discriminated from static library (with .a suffix). Static library will be linked at linking stage instantly after codes are compiled, before binary product output.

The method resetTransform of SCNPhysicsBody

According to the SceneKit document, the function of resetTransform is: Updates the position and orientation of a body in the physics simulation to match that of the node to which the body is attached.