The day started fairly slowly. I researched a lot about the gyroscopic capabilities of the iPad, as well as went through a lot of documentation on CMMotionManger, the library we will need to import to use the gyroscopes. Unfortunately I wasn’t able to make any rudimentary apps to test, because we didn’t have the developer versions set up, and you can’t simulate CMMotionManager on Xcode like you can with other libraries. I think I have a pretty good grasp of the core concepts, but will definitely need to relook over the documentation before I make an app for it, as well as some relevant code samples which I found online. For instance, here is a pretty good piece of sample code which we could build off of to see how well we could use the MotionManager environment:http://stackoverflow.com/questions/27783658/swift-gyroscope-yaw-pitch-roll.
After that I started working on making a new game, relatively from scratch (I still glanced at my work for yesterday to see how to correctly set up the View Controller and the Scene, two things which I’m not 100% confident on). I decided to make a variation of the game 2048. I found my own assets, and set up the various parts. I came back to it after lunch, and the work devolved into learning about subscripts and Object extensions in swift. Subscripts are incredibly useful, but also quite finicky, and I’m not exactly sure how they work, so I will spend some time tomorrow reading through some documentation on them. Object extensions made a little more sense, but the rules of mutability are a little confusing. I ended up having to scrap one extension I was trying to make on the Array class, and instead implemented it as a fairly clunky method in my Level class. A good two hours were dedicated to learning how type conversions worked in swift between Optionals. I ended the day with the most interesting bug, which I will have to fix tomorrow. I was trying to make an equality check, but I was given the error that “cannot assign a value of Type “Array<ObjectType?>” to a value of Type “Array<Optional<ObjectType>>”. But placing a “?” at the end of an object is the syntax for declaring it Optional, so “<ObjectType?>” should be equivalent to “<Optional<ObjectType>>”. Very frustrating, but I’m sure I’ll figure it out tomorrow. Swift just is very finicky.