I have recently launched an Android app and I will soon post an article on how to get Push Service from Firebase integrated with Parse Server, hosted on Heroku.
Tag: Programming
Safe area fix guide for earlier versions of iOS
Safe area layout is introduced in iOS11 but what can we do if we are supporting < iOS 11 and we have a xib view that is initiated in a ViewController and somehow the upper part of the xib view appears behind the NavigationBar??? To fix this, simply add this line in your viewDidLoad
.
self.edgesForExtendedLayout = UIRectEdge.init(rawValue: 0)
For more information visit EdgesForExtendedLayout at Apple.
Embed a UIViewController in a UINavigationController Programmatically
We know how to embed a ViewController in a NavigationController in Storyboard. However, I came across a scenario where I had to initiate it programmatically. The code:
let viewController = MyViewController() let nav = UINavigationController(rootViewController: viewController) self.navigationController?.present(nav, animated: true, completion: nil)
Android Threads and updates on Main Thread
Skipped 55 frames! The application may be doing too much work on its main thread.
DispatchQueue.main.async {
self.tableView.reloadData()
}
self.tableView.reloadData()
in the main thread to present this new data in the view.final Runnable checkMarkIsVisible = new Runnable(){ @Override public void run() { checkMark.setVisibility(View.VISIBLE); } };
final Handler mainHandler = new Handler(mContext.getApplicationContext().getMainLooper()); new Thread(new Runnable() { @Override public void run(){ //Perform som task if( isItemInList(myItem, myList) ){ mainHandler.post(checkMarkIsVisible); } } }).start();
You will not receive the error message anymore.
Edited:
A friend tipped me off after reading this post that instead of having to grab the main thread, you can also run on main thread using runOnUiThread
:
new Thread(new Runnable() { @Override public void run() { final String result = performBlockingTask(); runOnUiThread(new Runnable() { @Override public void run() { mTextView.setText(result); } }); } });
Podfile syntax
Create a file named Podfile
in root project directory.
platform :ios, '11.0' inhibit_all_warnings! use_frameworks! target 'MyApp' do pod 'SwiftyJSON' end
Run pod install
and open .xcworkspace file.