Author: Trevor

  • iOS Swift Navigation With Manuel Segue

    iOS Swift Navigation With Manuel Segue

    Unwind Structure Example @IBAction func unwindToTheVC(segue: UIStoryboardSegue) { if let source = segue.source as? OtherVC { print(“From OtherVC”) } }     Manuel Segue Example func gotoSegue(_ sender:Any){ guard let destination = UIStoryboard(name:”Main”, bundle:nil).instantiateViewController(withIdentifier: “TheTableViewController”) as? TheTableViewController else { print(“Could not instantiate view controller with identifier of type SecondViewController”) return } destination.variablesToSet = vars destination.unwindTo…

  • Git Clone With Specific Branch

    Git Clone With Specific Branch

    Cloning specific branch in repository. Example 1 git init git remote add -t refspec remotename host:/dir.git git fetch   Example 2 git clone -b my-branch git@github.com:user/myproject.git  

  • iOS Swift Find Exist Fond Families In The Project

    iOS Swift Find Exist Fond Families In The Project

    This code showing the font families and real name of the fonts.   for family: String in UIFont.familyNames { print(“\(family)”) for names: String in UIFont.fontNames(forFamilyName: family) { print(“== \(names)”) } }  

  • Resolving CocoaPods Install Problem

    CococaPods is not stable installer sometimes it install but not link to the project properly. This creates a runtime error. Reference is here. Deintegrate the cocoapods (means uninstall the pods) can help to refresh the install. You can install the tool with sudo gem install cocoapods-deintegrate Will uninstall the existing Pod files but keep the…

  • Xcode Export Entire Build Log

    In order to determine  a build problem, export the log into text file. Navigate into project, in terminal type line below xcodebuild -project yourproject.xcodeproj -scheme YourBuildScheme -arch arm64 -sdk iphoneos > build-log.txt 2>&1  

  • Making iOS Swift App Without Storyboard, Just Programmatically!

    Making iOS Swift App Without Storyboard, Just Programmatically!

    Storyboard is a good thing but has some side unwanted effect. You can find many discussion about it. Personally I don’t like it so much especially when I make an application without default navigation system it is useless, slow and makes me tired. I prefer creating my UIViews separately and link them to their UIViewController’s…

  • iOS Swift Initialising XIB And Bind To The Controller Without Storyboard

    iOS Swift Initialising XIB And Bind To The Controller Without Storyboard

    It is very useful to able to initialise  xib files independently from storyboard. Here is what to do with a line of code: //Calling the initializer in the ViewController convenience override init() { // ViewName is by convenience same name. // I use like: BlahV.xib BlahVC.swift self.init(nibName: “BlahV.xib”, bundle: nil) //initializing the view Controller form specified…

  • Git Submodule Adding To Existing Git Project

    Git Submodule Adding To Existing Git Project

    Tidy way of adding 3rd part frameworks in your project is; First, go into project folder clon the 3rd part frameworks in this with git command below. It will create a Frameworks folder and sub folder for the desired repository. #example below for adding SwiftyJSON git submodule add https://github.com/SwiftyJSON/SwiftyJSON.git Frameworks/SwiftyJSON #example below for adding Alamofire git…

  • Playing YouTube Videos In iOS Device

      Playing a YouTube video in the app is very easy with UIWebView Here is a snippet // YouTube video  @IBOutlet weak var webView: UIWebView!     // MARK: – Embed Video Player // id is like: xjr89789234 (grab this from youtube url)     func loadYoutube(_ videoID:String) {         guard    …

  • Update An Already Forked Branch

    Update An Already Forked Branch

    For updating a forked branch on Github or any other git related system. First you need to clone your forked branch on your local machine because there is no any one click updater solution.

  • Git Merge Branch Into Master

    Git Merge Branch Into Master

    Merge branch name “test” into master   git checkout master git pull origin master git merge test git push origin master      

  • Xcode Auto Incremental Version And Build Number

    It’s very useful to track version changes during the development and even after release. It allows us to detect the problems belongs to build and/or version. Doing this manually is not easy and boring. I was looking for a solution to make it  automatically. This github resource helped me lot. I don’t know if he’s…