Refactoring Storyboards With Storyboard References

referencecheckbanner

A common question facing an iOS team when starting a new App is whether to use Storyboards or not. As a professional iOS developer I don’t think this is an either / or question – you need to know both how to programmatically define and use UIViews (including Auto Layout) and how to effectively use Storyboards in a team environment.

At WWDC 2015 with Xcode 7 Apple introduced Storyboard References and the ability to Refactor your large storyboards into more manageable Storyboards from within Interface Builder to avoid the Storyboard merge conflicts. Continue reading

Swift 3 Challenge 3: Order

Nesting-Dolls

Continuing our Swift 3 Challenges today’s challenge has to do with order.

Problem Description:

Given three ints, first, second, third, return true if
the second is greater than first, and third is greater than second.
However, with the exception that if the parameter “itsOk” is true,
second does not need to be greater than first but still better be less than third.

Continue reading

Swift 3 Challenge Deux: Birds Singing

Swift_Animated

Another day, another Swift 3 puzzle. This one is about singing birds. Remember to try it before you look at my solution.

The problem description states:

The birds in Florida like to sing during favorable temperatures.
In particular, they sing if the temperature is between 60 and 90 (inclusive).
Unless it is summer, then the upper limit is 100 instead of 90.
Given an int temperature and a boolean isSummer,
return true if the birds are singing and false otherwise.

Continue reading

Fruity Crush Saga App Diary: Day 6

heart shape of fresh berries

In order to provide a visual cue to the player the selected swiped fruit should be highlighted momentarily in order to indicate which fruit the player is about to swap. This selection highlighting animation can be achieved by temporarily placing a highlighted version of the sprite on top of the current sprite and having it along for the ride in the swap animation and eventually fading out. Continue reading

Fruity Crush Saga App Diary: Day 5

valigia piena di frutta

Having completed the swipe to swap it was time to update the model and animate the swap. This involved creating a new Swap struct. In Swift the struct is a value type versus a class which is a reference type. Here it makes sense to use a struct since the swap is inert and only stores data. The logic of handling the swap is not done by the swap itself. The detection of the swap is handled in the Game Scene and the real game logic is in the Game View Controller. Continue reading

Fruity Crush Saga App Diary: Day 4

Fruits

The essence of the match-three game is to move fruits such that three fruits of the same type match up. This move is done with a swipe. The Game Scene is the best place for implementing the detection of the player’s swipes that will reposition the fruits into this match pattern. The reposition is called the swap. Recognizing these swipes to swap in SpriteKit is best done with the touchesBegan, touchesMoved, and touchesEnded functions.  Continue reading