Using SQLite with Swift

Wednesday, May 4th, 2016

Sometimes it just over-kill to use Core Data for some simple database operations, especially when the data is stored in the app bundle, and data retrieval is the only thing you need. Apple doesn't provide high level API for SQLite in Cocoa / Cocoa Touch framework as of iOS9. It only provides a C library. […]


Using Vector Graphics

Friday, April 8th, 2016

Preparing UI graphics for various devices could be a tedious job with normal, @2x, @3x resolutions… Using vector graphics reduced the hassle of this. Here is how: Prepare the vector graphic in PDF format with 1x resolution Create a new image set in Assets.xcassets, and select "Single Vector" in Scale Factors Drag the PDF file […]


Video File Size of iOS9

Wednesday, April 6th, 2016

Prior to iOS9, the file size of video stored in the Photos library can be easily retrieved by ALAssetsLibrary. However, ALAssetsLibrary has been deprecated in iOS9 and using Photos framework is a bit tricky to do so. Here's how. Implement UIImagePickerControllerDelegate method to get the info of the media file that the user selected. Get […]


Popover

Wednesday, April 6th, 2016

To present a popover, the simplest way is to present a view controller in storyboard by using segue, and setting the "Kind" option to "Present As Popover".  Popover in Compact Size Class (iPhone) The default behaviour of popover is that it will present modally when the horizontal size class is compact, so it will […]