Tag: swift



Salad Shake, Our Food & Drink App!

salad shake

Over a year ago, my husband and I started learning Swift in an effort to make our own app for iOS. Pretty much a year later, we finished Salad Shake, a Food and Drink app for iOS Devices. We learned a lot, and we’re getting ready to launch it on July 11, 2016 to the Apple App Store. It’s been a real roller coaster ride for us. Learning Swift was scary. Then finding out just a few months after getting comfortable with the language that Apple is releasing a new version was also scary. Figuring out how Swift handles data took some patience. Then navigating the Apple Developer Tools to just get the app submitted was an adventure. However, it’s done and is approved for sale on the Apple App Store.

Salad Shake is Launching July 11

The app is called Salad Shake, a unique little thing that suggests things to put in your salad. Salad Shake isn’t online until July 11, 2016. You can check out the landing page I set up for it here: http://saladshake.io

I’m quite proud of what we’ve accomplished. We didn’t use Interface Builder for any portion of it. Coded Salad Shake entirely in Apple’s language, Swift. We even built our own algorithm and I designed and drew pretty much every art and graphical asset in the game. I even have a bunch of freebies you can grab here: Get Some Free Salad Shake Stuff!

Did I mention that I have no video capabilities, put together a preview video using After Effects anyway? You can check out that video here: Salad Shake Preview Video

I’ll be making another post on launch day to give you all the link to Salad Shake on the Apple App Store. In the mean time, we’ve discovered that after overcoming the programming hurdle to actually make the app, the biggest hurdle in this entire process is marketing. While working in design and development of websites is something I’m fairly comfortable with, marketing has always been handled by someone else so I’m learning a lot of things about marketing–primarily that it is really, really hard.

If you run a blog or channel YouTube and you’re interested in featuring or reviewing our app, feel free to get in touch with me using this good ole contact form, or message me on Twitter: @imbriumapps and let me know you’re interested in Salad Shake and I’ll get back to you faster than you can say, “Go” and we’ll set something up.

Salad Shake is a Food & Drink app for iPhone 4s and better, iPad Air and iPad Pro. It will be released on July 11 and will sell for $0.99. No ads in the app, no in-app purchases and no subscription fees.



Swift: Cocos2D and SpriteBuilder Developer Guide

Starting off a while ago, I attempted to get familiarized with the Cocos2D game framework. Things ground to a halt when I realized that 1) I wasn’t familiar enough with Obj-C to comprehend the same things within Cocos2D, 2) Things were transitioning to Swift at the time and so was I, and 3) There didn’t seem to be any guide that I could find to lay out the basics for the framework.

Fast forward almost a year later and a wayward Google search to figure out an unrelated problem sent me to a post by Steffen Itterheim. Following the link, led me to a handy developer’s guide that I realized was exactly what I had been looking for. Steffen did state in his post that it wasn’t well-known and he had posted it back in January 2015–and you know what? It’s still not completely well-known because I had to stumble upon it.

So here it is:

Developer Guide for Cocos2D and SpriteBuilder

I don’t know what’s up with the hard to find(edness) of this thing, but it’s an incredibly useful document for beginners like me looking to get into Cocos2D and using SpriteBuilder. Therefore, it needs to be shared and spread around as Steffen said.

As for my initial problem? I was actually looking for an explanation for why my graphics had to be scaled down by 10% within SpriteBuilder. Still no answers for that, but hey, at least I got the developer’s guide!

Resources

Developer Guide for Cocos2D and SpriteBuilder on MakeSchool
Learn Cocos2D

 



Swift: Arc4Random Type Casting

I’ve been struggling like usual with a relatively simple problem the last two days this time, it’s getting arc4random_uniform to give me a randomized value from an array. Sure, it’s an easy problem for someone more experienced, so prepare to laugh.

It occurred to me to type cast arc4random the instant I saw the error. I don’t know why it took me so long to actually figure out how to do it, but a helpful StackOverflow solution pointed me in the right direction:

let myFruits = ["bananas", "apples", "oranges", "grapes", "cherries"]
 let randomFruit = myFruits[Int(arc4random_uniform(UInt32(myFruits.count)))]
 println(randomFruit)

The thing with type casting arc4random (bear with me here), is because it takes a UInt32. Which is an unsigned 32-bit integer, this is a number that cannot dip into the negatives–unlike a regular integer which can dip into the negatives. I was trying to get it to spit out a regular integer and Swift was having none of that. Beyond what I got up there, I needed to output three values instead of just one, so I iterated through the randomization using a for loop to get my randomFruit values:

for var i = 0; i < 3; i++ {
let myFruits = ["bananas", "apples", "oranges", "grapes", "cherries"]
let randomFruit = myFruits[Int(arc4random_uniform(UInt32(myFruits.count)))]
println(randomFruit)
}

Up there is a standard for loop using a variable of i to interate 3 times. Each time the loop runs, it randomly chooses one of the values within the myFruits array and prints it out.

You should be able to get three randomized selections from the myFruits array at that point. Now, the values do get repeated, I haven’t worked out yet how to get it to select a unique fruit every time, but it’s a start. I don’t know if that code is great or ugly, all I know is that it works. If you have any suggestions for improvement, by all means let me know!

Resources

Randomly Select a Value Using Arc4Random_Uniform on StackOverflow



Flappy Bird-Like Games & Swift Countdown

Seems to me like everyone and their cousin has a Flappy Bird knockoff on the app store. Call me slow on the uptick, but I only recently discovered that App Flipping existed. I don’t like the industry or the approach. But I can’t deny that if someone makes a buck flipping apps–then they’ve–made a buck (I guess)? The thing is, I don’t know if it’s because Flappy Bird is easy to make, there’s a ton of tutorials that teach people how to make it, or if there’s just a lot of abandoned source code for it out there. But it’s like a 1/10 chance (not scientific) that when you look a dev’s portfolio, they have some kind of Flappy Bird thing.

Of course, there’s also a ton of tutorials out there that pretty much show you from start to finish how to make a game just like it. I found this one to be one of the better ones (Obj-C): Learn to Build Flappy Bird by MakeSchool.

Countdown Timers for Swift/Spritekit

That’s not what I worked on today though. I was actually working through building a countdown timer as one of the small components of one of the games we’ve been working on. The point of it was to start the countdown and delay the code when the user reaches a certain screen. Initially, I tried to make the countdown by just using NSTimer and was having all kinds of errors pop up and once those errors were addressed, I still couldn’t get the timer working. I then used GCD (Grand Central Dispatch), which evidently ignores some components in a game’s pause state.

Probably the best way to learn is by making mistakes, and building really bad code. Then going onto StackOverflow and discovering a much better way to accomplish what you were trying to do and then realizing you were wrong for the last week. After the self-defeat washes away, you plug in the code and proceed to understand every single character in it as well as the theory behind it so that the next time you want to make a 58 line countdown timer (I know, I know), you’ll realize that you weren’t thinking about it hard enough.

Here’s the code that helped me get to where I needed with the countdown: Pausing a Scene with SKAction for Swift/Spritekit

In other news related to the app, I just finished the last of its over one hundred graphical assets and I’m looking forward to putting those together and seeing them actually working in the app itself. We are going to be tackling the data handling next so I’m sure you’ll be hearing about that soon.

Resources

Some of the stuff I looked at this past week…
SKAction Documentation (Apple)
SKAction.waitForDuration Troubleshooting on StackOverflow
Fetching Data from the Web With Swift (Trivia App)
The Mobileys
Marketing an App Infographic



Swift: A Designer Tries Learning Swift

I’ve been wrestling with Swift for a few months. Before that, it was Objective-C. Of course, I’m talking about Apple’s development languages for their mobile platforms. Truth is, I don’t know how far I really am because some things make sense and some other things that should make sense, don’t. What I’m going to start doing is talking about my learning process with Swift. I had started out with Obj-C and then had to stop because it seemed as if Apple was trying to move away from it. That moment when I realized close to a year’s worth of banging my head on the wall with a language they were going to move away from was probably pretty funny–unless you were me.

Sure, I know the foundations are the same no matter what language you pick, but trust me on this, aside from some very old C++ knowledge, HTML, CSS, Javascript and PHP, I’m pretty much a greenhorn. I know it doesn’t sound like it, but I am. There is a difference between frontend development and programming for applications, especially while learning swift.

A couple of weeks ago, I had the pleasure of reading Chris Bowler’s blog: One Man’s Journey to Learn Swift. Chris put a hold on his project because of an awesome career opportunity, so I reached out to him expressing my interest in picking up where he left off. I liked his honesty and approach, the fact that he documented the frustrations that I can so readily identify with.

Here’s Where I’m At Learning Swift

I’m a UI/UX designer and front end developer. You can see a summary of skills on my about page. What isn’t listed on there that is somewhat relevant is a brief period of time that I spent with C++ almost a decade ago. I also used to work with Actionscript 2 and then Actionscript 3–that was also a few years ago. The rest of the time, I’m an HTML/CSS/JS/PHP kind of gal. I am by no means a programmer so when you read these entries in my blog and you feel like screaming because I’m missing a basic component–it’s not on purpose. 🙂

What I am Trying to Do

Like Chris, I have an idea for an app. Well, actually, it’s several ideas that my husband and I want to get off the ground. We’re more interested in making games than utility applications though, which adds an additional layer of complexity to the whole mess. My one saving grace is my better half. He has programming experience in C/C++, he also picks up on this stuff a lot faster than me (probably because of the programming experience).

I don’t expect to be dropping apps on the app store in a year, or even two years. But this isn’t about pushing out a bunch of apps, it’s about improving my skillset because I would like to offer application programming as a service one day, or even just using learning Swift as a launchpad into more in-depth application programming. And at the very least, I want some of these ideas out of my head.

My Resources

All right, since I’m already a few months into this process, I’m going to share what I already went through. When I was first starting with Obj-C, I was buying books (yes, I’m old school). That was a frustrating experience because the time I had to dedicate to Obj-C was less than an hour a day and it seemed like every time I was close to finishing a book, something about the language was changing and the next thing I knew, the book was outdated. So it truly felt like I was making strides forward, then having to stop and take a few steps back, I did make it through one book completely though. I know there’s a lot of chatter amongst devs that Obj-C is difficult to learn and intimidating–it is, but it isn’t insurmountable. Anyway, I can recommend this book:

Objective-C Programming: The Big Nerd Ranch Guide (2nd Edition) by Aaron Hillegass & Mikey Ward

It’s short enough that you should be able to surge through it. OK, so that was Obj-C. Let’s talk about Swift. One of the things I promised myself when I started down the Swift path was that I wasn’t going to buy any books. The first place I started was on Lynda.com where A fellow named Simon Allardice publishes his excellent series teaching the basics of Swift along with some theory. I liked Simon’s approach because while he rehashed the foundations, he also took the time to explain why things were done the way that they were. I recommend his courses:

Swift Essential Training by Simon Allardice
Comparing Swift and Objective-C by Simon Allardice

That second course was actually very useful, especially if you already know Objective-C. After Simon’s courses, I went off and started poking around with Swift on my own. Managed to make a very inefficient (but it worked) text-based, choose your own adventure game. In an attempt to figure out some of the errors I was encountering while making the text-based game, I came across MacHeads101’s YouTube Channel where he recorded himself trying to learn Swift for the first time. Now MacHeads101 already has programming experiencing, and a lot of it. But it was interesting and surprisingly helpful to see how he troubleshot errors. I watched the following videos:

“Learning Swift Attempt #1 – Creating a Calculator” by MacHeads101
“Learning Swift Attempt #2 – A To-Do List App” by MacHeads101
“Learning Swift Attempt #3 – Draggable Views” by MacHeads101
“Learning Swift Attempt #4 – Operator Overloading and Objective-C Bridging” by MacHeads101

He was using the beta version of Swift, and I was using Swift 1.2 so some of the things he did threw errors for me and some of the errors he had weren’t showing up for me. Still, it was a great learning experience because it forced me to figure out how to fix the errors I had. I don’t know if it was just me, or if anyone else felt helpless whenever they discover they had an error in their code. It was especially frustrating because any errors I had in HTML/CSS/JS/PHP, I was usually able to tell immediately what was causing it–not so much with Swift. By the end, there wasn’t any reusable code, but I definitely felt better about troubleshooting my own Swift code.

Finally, I was starting to do more with Spritekit. That was pretty much when I found Chris’ blog. At the moment, I am going through these component tutorials from iOScreator:

iOScreator Tutorials

Chances are pretty good that an app will be released in the coming months, though the majority of the programming will be thanks to my husband while I work with the design and user interface. But I still intend to get good at this stuff because it is incredibly useful to know. I’ve always been fascinated with code and it was nigh time I learned an actual programming language. So I’m going to document by progress from here and going forward.

You’re going to read about all the embarrassing rookie mistakes I make, see some of my sloppy code, watch me get frustrated as I try to find help with Swift and end up with a bunch of Google search results about Taylor Swift, and maybe even laugh at me. And that’s OK. I’m still looking forward to it.