Posted in coding, project

To Code or Not to Code?

When it comes to building a complicated app full of exciting little things there are a couple of things that have to be thought about and are fundamental to the creation of such a project: time, money and ability.

When I set out on this project, the plan was to be able to learn coding in a comprehension and clear way before I got started with assignments and other fiddly little things that life throws my way this time of year. Sadly, because I was off being awesome in London, I wasn’t able to do that and so that great enemy Time has become precious and fleeting.

Do I have the time and the ability to be able to code the app the way I wanted to, from the ground up? I’m not sure. I’m really, really not sure.

So this throws some rather large spanners into already complicated works.

I’ve been advised that I don’t reeeeeaaallly have to build the app. As long as I put together a full, comprehensive development plan and bible (which could be anything up to 100 pages) then I’ve got a pretty good start, as well as developing networks with guys who already build apps and may be able to help me out in that regard. Which takes a weight of my mind, but equally makes me a bit sad inside.

Equally, there is a chance for me to build the app in a simple, stripped back and non-code-requiring way. Maybe. That’s still only a maybe. And although it means that if I could use it then I could genuinely have a working prototype to show people (which is amazing), there’s a part of me that feels like it’s a bit of a cop-out and that I’m sacrificing some key interactivity features for the sake of making things easier on myself.

It’s a difficult one.

I’ve decided, therefore, to go back to the start of this post and plan things as such: If I have TIME, I will code. If I don’t have time, I will consider MONEY. If I have some time and no money, then I will build according to my ABILITY of using a simpler program, with projected future possibilities built into the development plan. If I have ALL THREE, well, then I am going to attempt to code the shit outta this thing.

Is it just me, or does my plan sound like I still don’t know what I’m doing…?

Posted in coding

I Start Learning Code Things

After a bit of a break from the actual coding side of things, now is the time to start wrapping my head around it. And there’s a lot to wrap my head around.

Xcode and Swift is an object-based code. Unlike C++, this kind of code follows a particular model structure that creates objects and then, basically, you tell that object what you want it to do based on a series of methods and properties that you assign to them. This means that the code is a lot more flexible and fluid in its development and content creation.

And if all this sounds a bit confusing, don’t worry – I can’t really wrap my head around this right now either.

The issue I’m having at this point is that it is all in the abstract. I understand these principles and how one thing connects to the other based on a series of words and symbols, but I’m not sure yet how these can be used to create anything. It’s absolutely fascinating, but what exactly does it do? I haven’t reached that bit yet. The best I can do to explain is that it currently feels like I’ve been given a lot of letters and words, but haven’t been told what the point of a sentence is yet.

I’m sure it’ll all make sense soon as I start to apply this abstract code to an actual project. Once I can place the code within a context, I’m sure all of it will fit into place. At least I hope so.

And what happens if it still doesn’t make sense?

Well, I’ll probably panic for a bit and then I’ll re-evaluate. At this stage, I’m just going to keep ploughing through until I get somewhere. I’m also looking at other Swift and Xcode videos to give me some extra ideas and tips to help build the app. It’s helping a bit to have this supplementary information, although a lot of it seems to be geared towards a very basic UI development, rather than a more complex app structure. At least these are all good starting points for me.

Once I figure out how all this is connected, I’ll write up a more detailed post on the coding. While I’m still learning, and still very much unsure, it’s probably best I don’t lay it all out and potentially get myself confused (more confused?!).

If you’re interested in knowing a bit more about this coding structure, have a look into Objective-C. It’s what Swift is based on, although it is a little different.

Posted in coding

Layout of a User Interface

After the initial look at Xcode, now is the time to start getting to grips with it. With the tutorials I’m using, I’m starting with the layout elements for the user interface (UI). At this stage, there’s no ‘real’ coding involved. But given how daunting this whole task seems to be, it’s nice to be eased in gently.

interfaceA lot of Xcode’s interface comes from elements that you can select, drag and drop onto the view screen. This, I guess, means that a lot of hard work is done for you – you’re just adapting what’s already there. The only real thing that takes time at this point – and even then, it’s not terribly difficult – is setting the constraints for how the elements should be positioned within the app.

Xcode’s view screen isn’t the true representation of an iPhone screen. Just dropping things in place, doesn’t mean that’s how they will appear when the user opens the app. So, you have to set constraints on how the element will be positioned (for example, how big an image should be and where it should sit on the screen). This means adjusting size ratios and x- and y-axis margins to make things fit. All of this in done from little tab buttons at the bottom of the view screen.

And it’s just a case of moving things about, then checking them in the simulator to see how they look, then adjusting them again if they’re not quite right.

This would normally be a straightforward process, except the MacBook I’m borrowing is apparently steam-powered and can’t run the simulator without crashing on me. Access to another Mac needs administrator permission, so the simulator won’t run at all. Hmmm, might have to hunt down another Mac I can use once I’ve made it through the tutorials and start developing my own app.

There are a couple of little things to look out for when creating these layouts, and their constraints. You have to think about the fact that an iPhone (or any device now) can be turned both portrait and landscape. When creating your UI, you’ve got to make sure the layout is correct for both. There’s a handy little tool for that too – at the bottom of the view, you’ll see wANY and hANY. This is the width and height, and by clicking on it you can adjust the view of the app and set the constraints to that view. Pretty handy.

These really are very early stages in my understanding of Xcode, but so far I’m pretty happy with how simple it is to use. Once we get to some coding, well see how confident I am then!

To follow the same tutorials as myself, check them out here.

And to see my video of the initial book content for my project, check it out here.

Posted in coding

It Begins

Now that I’ve solidified the concept, I’ve written it fully in a document that helps keep all my thoughts in order. When I get lost in the code, I can return to this document and remind myself what it’s all about.

To coding…

As I said before, I’m using Xcode 7 for Mac. At first I was going to jump into the books in the library to grab some information, but sadly they’re all for previous versions. I’m sure the content’ll be similar, but it’s best to keep as up-to-date as possible, so it’s to YouTube I go. I’ll be following these tutorials to start with, and possibly branch out to other videos once I get well underway.

In addition, I’ve got the other half helping me. He’s familiar with basic C++ coding. The plan is that we watch the videos together, and if I get stuck with any of the things discussed, he can bail me out and show me where I went wrong. This is another one of those ideas which is either brilliant or really stupid. With any luck we’ll still be married by the end of this…

 

I have to say, so far so good. I’m working in Xcode’s ‘My Playground’ feature at the moment, which allows users to just mess around with code to see what can be done. It’s very clear that you need something to help guide you with programming language. That’s the bit I’ve got to get to grips with, as nothing will work if you don’t know it. Xcode doesn’t have a feature that explains this to you; so having YouTube handy is a real plus.

It’s also useful to note that Xcode uses Apple’s Swift coding. Although (I have been informed) it is similar to C++ and other coding languages, it’s not identical, so don’t be fooled into thinking that if you’re vaguely familiar with one system, you’ll know this one. However, to someone brand new to coding, Swift is beginner-friendly, and keeps things simple for you.

I’ve wrapped my head around ‘var message = “Hello World”’ and I’m pretty proud of that first step. In fact (and yes, I am very aware that these are the early stages) it all seems fairly straightforward. The easiest thing to compare it to is very basic algebra. Don’t worry, a degree in mathematics doesn’t seem to be necessary; just remember that letters or words can stand in the place of numbers.

A = 10

B = 20

A + B = 30

That’s it. Easy, right?

 

As long as you understand what the variable stands for and how that can work in relation to the ‘if’, then it makes reasonable sense. ‘if’ is the logic of the coding. It’s basically the code’s way of saying: ‘If this happens, then this can happen.’ I can understand that.

FullSizeRender
Xcode My Playground

To take the above example:

If A + B (30) is greater an amount than A (10) then you can make the code say “hello”.

Or in the actual code:

if (A + B > A)

{

print(“hello”)

}

So I think I’m ready to move onto the next stuff. I really want to know how all this translates into the finished products we see and interact with every day. It’s one thing to understand a line of letters and numbers as one being related in some way to the other, but just how does it translate into the decision making processes of the user?

We shall find out…