How to make lighter AppDelegate in iOS

Issue #24 There is Lighter View Controllers, and there is Lighter AppDelegate, too Since working with iOS, I really like the delegate pattern, in which it helps us defer the decision to another party. The iOS application delegates its event to AppDelegate, which over time will be a big mess. Usually, the AppDelegate is where you put your root view controller setup, crash tracking, push notification, debugging, … and we just somehow violent the Single Responsibility principle....

May 10, 2017 · 3 min · 453 words · Khoa

How to debug Auto Layout

Issue #23 hasAmbiguousLayout Returns whether the constraints impacting the layout of the view incompletely specify the location of the view. exerciseAmbiguityInLayout This method randomly changes the frame of a view with an ambiguous layout between its different valid values, causing the view to move in the interface. This makes it easy to visually identify what the valid frames are and may enable the developer to discern what constraints need to be added to the layout to fully specify a location for the view....

May 10, 2017 · 1 min · 136 words · Khoa

How to create a piano using iOS 9 Auto Layout

Issue #22 In the beginning, people use frame and Autoresizing Mask, then they use Auto Layout, then iOS 9 encourages them to use NSLayoutAnchor, UILayoutGuide and UIStackView For more convenient Auto Layout, check How to make Auto Layout more convenient in iOS and Anchors NSLayoutAnchor The NSLayoutAnchor class is a factory class for creating NSLayoutConstraint objects using a fluent API. Use these constraints to programmatically define your layout using Auto Layout....

May 10, 2017 · 2 min · 380 words · Khoa

How to handle RefreshControl in iOS

Issue #20 The other day I was doing refresh control, and I saw this Swift Protocols with Default Implementations as UI Mixins extension Refreshable where Self: UIViewController { /// Install the refresh control on the table view func installRefreshControl() { let refreshControl = UIRefreshControl() refreshControl.tintColor = .primaryColor refreshControl.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) self.refreshControl = refreshControl if #available(iOS 10.0, *) { tableView.refreshControl = refreshControl } else { tableView.backgroundView = refreshControl } } } Protocol extension is cool but somehow I’m not a fan of it....

May 4, 2017 · 1 min · 181 words · Khoa

How to hack iOS apps

Issue #19 We need to care about security nowadays, here are some links I find useful to read more about this matter https://github.com/Naituw/IPAPatch https://github.com/cyanzhong/Retriever https://github.com/KJCracks/Clutch https://github.com/pjebs/Obfuscator-iOS https://github.com/UrbanApps/UAObfuscatedString https://www.raywenderlich.com/46223/ios-app-security-analysis-part-2 http://www.splinter.com.au/2014/09/16/storing-secret-keys/ Anastasiia Voitova: Keys from the castle: ancient art of managing keys and trust https://www.hopperapp.com/ https://github.com/iosre/iOSAppReverseEngineering CocoaPods, Exposed Analysis of the Facebook.app for iOS [v. 87.0] http://quellish.tumblr.com/post/126712999812/how-on-earth-the-facebook-ios-application-is-so https://www.objc.io/issues/19-debugging/ https://github.com/felixgr/secure-ios-app-dev App Security in Swift Securing Communications on iOS How I discovered Instagram’s upcoming video calling feature on iOS https://blog....

May 3, 2017 · 1 min · 185 words · Khoa

Hello world, again

Issue #1 I’ve used Wordpress, then moved to GitHub Pages with Jekyll, Octopress, Hexo, Hugo. You can view my page here http://fantageek.com/. It was good with all the custom themes and Disqus But then I was a bit lazy with all the commands generate, commit, deploy, it hinders me from writing, so I moved to Medium. The only thing I like about Medium is its discovery, your posts have high chanced of finding and viewing by people....

April 26, 2017 · 1 min · 204 words · Khoa