Skip to main content

Building my first iOS App

I have been following along with a PluralSight video by John Sonmez, to learn the basics of developing for iOS. After creating a simple "Hello World" app, he moves into creating a protein tracking app. I have recently been looking into a diet change that would see me limit the amount of carbs that I eat significantly, so I plan on taking the protein tracking idea and apply it to carb tracking. Hopefully I can create an app that will be simple to use and will help me follow my new diet. After I complete the course, and with it a starter app, I will try to add to this app and give it new features while also expanding my knowledge of iOS development.

So the first steps are to put some controls on the screen. This reminds me a lot of how Visual Studio works when in Design mode. You have a "toolbox" full of controls and you can drag and drop them onto the view. You align those controls with guidelines provided by the IDE. You can anchor a control to a part of the view or to other controls. This seems like a really nice way to get some basic functionality in the view, but I do not tend to work in Design mode in VS. I will always switch to Source mode and add my controls in code. I expect that I will be able to do that in Xcode as well, but so far I have not learned how.

Another thing that is different at first is where some of the information for a control is at. Right now I have an information center on the righthand side and the section has a lot going on. It will probably take me a while to get used to where everything is and how it is laid out, or more likely as I learn more I will probably end up reorganizing things to work better for me. This is probably something I take for granted in VS because I have worked with it for so long, and had to start over with it so many times, that I know exactly where everything should be and how to rearrange things if they are not how I like them.

Connecting a control to the code behind is also new to me. I have most of my experience with Webforms in the .NET world, and there when you add a control the plumbing to the code gets created for you. Your code then knows about that control and you can go about interacting with it however you like. In Xcode, at least what I have learned so far, you drag from the view into the H file and it creates the link between the 2. Its fairly interesting, and somewhat satisfying, how the pieces create the link, however I assume that will get old quick and I will be looking for a way to do all of that in code as well.

In VB when you want to call a control, variable, or function, you just type the name and it will then let you interact with it according to the ways that object knows how to interact. In Objective C, if you want to call a function you need to wrap it with brackets and then have the name of the function first, followed by parameters. At least that is how I think things are working right now. It is fairly different from what I am used to, but I should pick it up quick.

Another big shift from Webforms thinking is defining objects and controls in the header, H, file. Each view has a header file that defines it's interface with a class, M, file that uses that interface definition. I see this as a good thing as it will likely make reuse of that code easier and more built-in. In Webforms because you just have a Class that your controls are put onto, by default you do not think about reuse or using an interface for things that ought to be. When you start out in Webforms you just place everything in a class and don't think any beyond that class. Here you get an interface by default, and decouple your control definition from their use through that interface.

Completing the Plural Sight course has given me a very basic app that will be a good starting point for what I want to create. I still have a lot of work to do before this app is ready to be used. I look forward to continue learning iOS development and building this app.


Popular posts from this blog

Converting a Large AngularJS Application to TypeScript Part 1

I work on a project that uses AngularJS heavily. Recently we wondered if using a preprocesser like CoffeeScript or TypeScript for our JavaScript would be beneficial. If our team is going to switch languages, we would need to be able to convert existing code over without much pain and we would have to find enough value in switching that it would be worth the conversion.

I had read an article that stated that because TypeScript is a SuperSet of JavaScript, you could convert a plain JavaScript file to TypeScript by changing the extension to .ts and not much else would need to change. I wanted to test out this claim, so I took a file that I was familiar with, an Angular Controller, and tried to convert it to TypeScript to see how much effort it would take and then try to figure out where we would benefit from using TypeScript.

This is what the controller JavaScript file looked like to start out with:
(function () { 'use strict'; angular .module('app') …

Converting a Large AngularJS Application to TypeScript Part 2

In part 1 I was able to take an Angular controller written in JavaScript and convert it to a TypeScript file while doing very little to change the code. In this post I am going to explore transitioning that same controller to actually use the features provided in TypeScript. This is how I left off my controller:
declare var angular: any; (function () { 'use strict'; var controller: any = function($scope){ ... } angular .module('app') .controller('controller', controller); controller.$inject = ["$scope"]; })();
While performing the translation from JavaScript to TypeScript, I would make sure at every step that the functionality I expected still worked, so if anything I did broke the system I would change it back and try again with another approach. Also if something seemed like it worked too easily, I would break it on purpose to make sure I wasn't getting a false result through browser caching a previously working fil…

Gamify TDD

I like it when things that would not normally be associated with games add concepts from games as a way to incentives you to accomplish things. Why simply go for a run if you can have an app that will track you and give you a gold star if you do better than you did the last time? Why go to the coffee shop that only gives you coffee if the other one will give you points that you can redeem for free drinks eventually?

I was recently introduced to CodeSchool, an online training system similar to PluralSight, it has video courses and challenges you can take to prove that you retained what the video taught. CodeSchool also adds badges and tracks to your learning, so as you complete a video and its challenges you get a badge. Complete a collection of courses within a specific discipline and you become a master of that discipline.

Some of these incentives are not tangible and really don't mean much in the real world, but they tend to work for me. If I start working towards a large goal a…