Create your own Blogger iOS app (Post created using same app)

Create your own blogger iOS app (Post created using same app)

So, this many months when I started seriously writing blogs I have been eagerly waiting for an iOS application to have on my phone so I can blog whenever I want irrespective of carrying my laptop. This was possible if I have an Android phone. I got to know until past few years even iOS had one for it. I am not sure why Google had discontinued it but today I am here to show you how can you have one for yourself in less than 5 minutes if you have all the softwares downloaded and right hardware.

Although it's not 100% comfortable as a native application but this work around can actually make you blog more as you go to your much more convenient position. This will be a great application on an iPad. Please note that this blogpost has been written on the app which I created and it is only recommended for a backup option.

Here are the hardware we require,
  • Apple MacBook
  • iPhone or iPad to install
  • ~5 mins of time (30 mins including all the downloading and configuration)
  • No coding knowledge required.
What softwares you require before and some prerequisites,
  • Xcode
  • Apple ID/free apple developer account (not needed to be a paid account unless you want to publish the app in play store which has high chances of getting rejected by Apple team).
As you know iOS or OS X apps can be developed only on apple hardware we should be having an apple MacBook for this application development. Apple also provides its own software for development of its apps.

Installing:

Install Xcode on your MacBook. You can simply go to app store and search for Xcode and download it. It's very easy installation process.


For more detailed installation of Xcode, please refer to this web page: Click Here

Open Xcode and perform all the initial license agreement tasks and then when you see the below
screen, you are all set to go.

Creating a Project and Configuring it:

Select the second option Create a new Xcode project 

Select the Single View App to continue and then click Next
Provide the details of your application like what do you want to name it in Product Name and Organization Name, Organization Identifier and Team can be None for now and then click Next
Here, you will be prompted to select a directory to save all the project related files. You can also opt to create a git repository on mac which you can later sync it onto any hosting git like Github or bitbucket etc.,  and then click Create
If you have not configured your git global identifiers it will pop you with a message asking you to fix it. It will also provide how to set them. You can do it at later point by clicking OK

This is how you see immediately when you finish all the above setup, you will be opened with General tab properties of the project.
Now you will be adding your Apple ID to enable it being deployed on your personal phone. (Note: At the end you will not list the app in the app store as it requires screening from Apple and also a paid developer account).

For detailed steps on how to add an apple ID and select your team, please follow this link

Once you set up the Apple ID in your Xcode, you should be able to select your name in the drop down Team on the above screen.

Coding: 

To achieve our goal of having our own custom blogger app, we just have to add a couple of lines to our code and make few customizations which takes no more than 5 minutes.

In the file ViewController.swift

add an import statement as
import WebKit
When we create the web view, we need to store it as a property so we can reference it later on. So, add this property inside the class now:
var webView: WKWebView!
Finally, add this new method before viewDidLoad()
override func loadView() {
    webView = WKWebView()
    webView.navigationDelegate = self
    view = webView }
}
That code will trigger a compiler error for now, but we’ll fix it in a moment. Now, change the Class name line in the file to below,
class ViewController: UIViewController, WKNavigationDelegate {
This program is almost doing something useful, so before you run it let us add three more lines. Please place these in the viewDidLoad() method, just after the super call:
let url = URL(string: "https://www.hackingwithswift.com")!
webView.load(URLRequest(url: url))
webView.allowsBackForwardNavigationGestures = true
Your final ViewController.swift looks like,

import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate {
    var webView: WKWebView!;override func loadView() {
    webView = WKWebView()
        webView.navigationDelegate = self
        view = webView
}
    
    override func viewDidLoad() {
        let url = URL(string: "https://www.blogger.com")!
        webView.load(URLRequest(url: url))
        webView.allowsBackForwardNavigationGestures = true
        super.viewDidLoad()
    }
}

Now as you have added your Team already your phone should pop up in the list of runnable platforms just like below,


At this point when you click on the Run (Play button) it builds the code and deploys the app on your phone. When you run your app on a device, you will also have to trust the developer first. On your device go to Settings > General > Profiles & Device Management > developer account name > Trust.

 Once it launches it opens up the blogger.com main page and asks you to Sign in

 Please provide your credentials and once you sign in you can go to blogger.com home page directly whenever you open the app.
 

In the below screen shot I am trying to create a new post using the app which we created. 

For other customizations like having an app icon and all please refer to useful articles like this 

Please try it out and it may be a useful app or a process for most of the bloggers to have it. You can keep updating the app with any modifications. 

Note: I have used my laptop only for capturing the screen shots and adding them to this blog post. Rest all of it has been written using the same application which I created using above process.

Please feel free to try it out and let us know if you have any questions in the comments

Thank you,
AV 






Image credits:
Only banner image credits subjected to respective owner

Comments