Skip to main content

Posts

Showing posts with the label Swift

Queue, Binary Tree and BFS in iOS Swift

Following on from my last post, this is a short post with code samples to achieve the above on Swift. I won’t talk too much about the background to Binary Search Trees or the BFS algorithm, instead just focus on the code. If you need to get more of a background to this post, then best have a read of my previous post,  Breadth-First Search in Typescript and Javascript. The code Just like my  previous post , this code solves the exact same problem, except here it’s done in Swift instead of Typescript or Javascript. class Node<T: Comparable> { var key: T! var left: Node? var right: Node? init(key:T) { self.key = key } } class Queue<T> { private var items = [T]() func add(item: T) { items.append(item) } func pop() -> T? { return items.removeFirst() } func isEmpty() -> Bool { return (items.count == 0) } } class BinaryTree<H:Comparable> { private var rootNode: Node...

Xcode project template with Firebase

Analytics is one of the ways in which you can know how users use your app and I think it’s very important to know how users use your app. It’s one of the things that we (or I) use at My Day To-Do (MDT) to encourage usage of certain features. What do I mean? I have written in the past that about my Software engineering background and as such my UI/UX skills are not the best. So the first think I think about when users don’t use certain features of my app is probably because they don’t know about it. Hence to compensate for that, I monitor how the app is used, so I know if the users aren’t using the features I think they should, I will add visual cues in the app to make the feature obvious for them. In almost all of the apps that I have developed at My Day To-Do, I have used Firebase Analytics to monitor app usage. In this post, I will just be talking about how to setup an iOS app with Firebase, provide some sample analytics code of the  Github repo  that I made for this ...