Swift vs. Objective-C: 10 reasons the future favors Swift

It’s high time to make the switch to the more approachable, full-featured Swift for iOS and OS X app dev

 

Programming languages don’t die easily, but development shops that cling to fading paradigms do. If you're developing apps for mobile devices and you haven't investigated Swift, take note: Swift will not only supplant Objective-C when it comes to developing apps for the Mac, iPhone, iPad, Apple Watch, and devices to come, but it will also replace C for embedded programming on Apple platforms.

Thanks to several key features, Swift has the potential to become the de-facto programming language for creating immersive, responsive, consumer-facing applications for years to come.

Read all 10 reasons for Swift on InfoWorld.

Posted on May 28, 2015 and filed under News.

The Top 3 Reasons You Need an Apple Watch

Apple Watch White

Apple's attention to detail is second to none.

This is something that I—as someone who has worked for the company—truly believe. This is why I make iPhone apps . . . exclusively. I have become a brand loyalist because, at the end of the day, Apple creates great products and delivers on their promises.

This fact sets the foundation for the top three reasons why you are going to need to own the new Apple Watch. With this innovative new offering, you’ll have the opportunity to connect with people instantly using touch and emotion; you’ll be able to track your health and care for yourself in ways that have never before been possible; and you’ll be on the forefront of technological advancement and medical research as a member of the open source ResearchKit community.

1. Instant Intimacy

This is the word that Apple uses: intimate. When I watched the initial announcement video, I thought this might be a gimmick. So what? It vibrates.

This is not, however, the same feeling that you get when your phone vibrates. That's usually a nagging feeling. It’s not sexy. In fact, when your phone goes off, it usually means you've got something to do.

The Apple watch allows you to connect with others using touch-sensitive technology. It contains a special Taptic engine that creates a three-dimensional feeling so that the person on the other end of the message can feel the pressure, sensitivity and force of the sender . . . it mimics that connection, so that it feels like someone is actually there in the room with you.

After listening to people who have interacted with the device—and actually experiencing it for myself—I realized that the simulation of the human touch is what drives the emotional component of this product. Just imagine: your heartbeat . . . proof that you’re alive.  Someone else is feeling what's happening inside of you at that moment.

With the Apple Watch, you can send a tap, your heartbeat, even a little doodle. It offers the ability to connect with your loved ones in a way that hasn't been possible before.

I've taken several massage classes, and the most important thing I learned from them is that human touch is crucial for our emotional well-being; it allows us to connect with the people around us. It's the Apple Watch’s ability to physically connect one human being to another that is so unique and exciting.

Sure, it’s a simulation . . . but for two people who live 3,000 miles from one another and see each other once a year, it can become a priceless substitute for sorely missed contact.

The animations that you can share with the watch are another part of this human connection. You can convey so much more with a .gif than you can a static image. That's what the animation feature allows: the ability to convey your thoughts to the people that you care about in ways that a simple text can’t. It's super personal, convenient and instantaneous!

2. Health on the Go

The Apple Watch is going to completely change the landscape of personal health and fitness. It’s going to provide the data that people need and provide actionable changes that individuals can make to improve their health.

Some products (the Olio Watch, for example) unapologetically state that they "don't want to focus on fitness." That's fine for some people, but if I’m going to have a computer on my wrist, it’s going to be one that's able to help me with fitness. There's no question about it.

A family member of mine passed away in October of 2014, and I truly believe that this was a situation that could easily have been avoided. That loss really changed my outlook on life and made me focus on how I want to live:

What do I want to put into my body? How much do I want to be working out? How can I make sure that I don't lose precious years of my life to a disease that I could have prevented?

My mom is a dietitian, and part of her work includes teaching people about the causes and results of diabetes. A lot of people go to the classes, but they end up feeling overwhelmed by the amount information they have to absorb and by the idea that they’re going to have to change their daily habits. It's frustrating for them, and I get that.

The fact is that we can control these things . . . but it takes motivation. It takes knowledge, and it takes a mentor—a buddy who can really help you.

The beautiful thing about the Apple Watch is that it allows you to work with the data you have. Armed with that knowledge, you can inspire yourself to work harder, set goals for the future, and even create healthy reminders for yourself. It’s a lot like having a personal trainer on call 24/7.

Steph and I have begun to prioritize our health and fitness because cardiovascular disease and diabetes are things that we want to avoid. We know that we can do that by simply living a healthier life.

Last year, I weighed 184 pounds (and I'm only five-five). I've got a more muscular build, but I was still overweight. I felt fat and it just wasn't a good place for me. Over the past year, I've lost 20 pounds and seven of those pounds came off in a three-month period just this year.

I’ve accomplished this by making small but impactful changes in my day-to-day habits: eating healthier and including larger portions of fresh, organic vegetables; setting myself up for success by planning ahead; and making sure that I’m doing some regular exercise. The exercise part has been really key, and it’s a part of my routine in which I believe the Apple Watch could become instrumental. In the meantime, it’s also inspired me to imagine some great fitness app ideas!

I've always wanted to do one hundred push-ups in a row. I only did it once. It took me four minutes and forty seconds in college, and it was incredibly difficult. I really wanted to get it down to two minutes, but I didn't know if I could. Now that the Apple Watch has arrived, I think it will be possible for me to make an app that would help me—and others—reach that goal.

There are additional features already programed on the Apple Watch (such as the stand-up feature, which you can enable or disable, depending on your preferences) that can help you on your way to making small changes.  For those of us who need that gentle nudge, it’s a great reminder that it's time to move around a little bit, and it can help you boost your energy throughout the day.

The ability to help individuals who need assistance goes hand in hand with offering medical professionals a chance to collect information from a huge population. This brings us to the final reason you will happily stand in line (or pre-order the Watch on April 10th) to get your hands on the latest offering from Apple.

3. Medical research opportunities

The golden ring for the makers and wearers of the Apple Watch is going to be the difference it has the potential to make on a global perspective. I don't see anyone else in this space, and I think this is a great move for the company.

Apple research is going to change the way the medical field approaches data collection and analysis, and Apple is pushing this initiative. Using the sensors on the Apple Watch as diagnostic tools, hospitals, universities, and other individuals will have the chance to create apps that can enhance research studies. This will allow us to interact with all the sensor data on both the iPhone and the Apple watch.

This research is going to give our medical community greater insight into how we function as living creatures. Research studies have to rely on a participant reporting his or her own daily routine, and this information is often inaccurate because people either lie or bend the truth without even realizing it. Researchers will now be able to analyze physical fitness and personal daily habits accurately and determine how both factors affect our overall health.

The best part about it is that you don't have to do anything special. The Apple Watch receives motion data that can be translated into long-term activity levels. It receives and analyzes your vital statistics and compiles the information for long-term analysis. Eventually, it will get to know you and become increasingly more accurate.

At the end of the day, this technology is going to create an opportunity for people who aim to make the world better on a daily basis by providing tools to increase data flow, deepen our insight, and vastly improve our general knowledge. I think that's going to be a game changer.

Moving Forward

Apple is about making the world better. They sell premium products because doing so allows them to create great experiences. I don't see any other company doing it the way Apple does it.

I do think that Apple research is going to be the reason that people switch over to the Apple platform. It's not going to be about customization or syncing with an office cloud or any of that jazz. It's going to be about how we can help make the world a better place; how we can participate in research studies and help people who suffer from illness and disease; how we can help improve lives, find cures, and help people understand the importance of health and fitness. That is why I'm excited about the Apple Watch and I think you should be too.

If you're interested in receiving more information on Apple products, apps and writing code, like this blog posts and subscribe. I'm open to more questions. I want to be talking about Apple and creating experiences using the Apple platform.

You can follow me on Twitter @PaulSolt

Posted on April 9, 2015 and filed under Apple Watch.

How to fix your SKEmitterNode particle effect - Sprite Kit Tip 1

Using special effects in your game is a great way to achieve a unique style or interesting visuals. In this short post, you'll learn how to leverage special effects compositing with the SKEffectNode and the SKEmitterNode.

Subscribe to the iPhone mailing list to learn how to build your iPhone game.

Want to watch the tutorial video? Skip to the bottom.

Out of the box the SKEmitterNode will default to an Additive blend mode (Add) – which can cause special effect glitches. Over dark backgrounds your particles will look like they did in the particle editor, but over white backgrounds they will be washed out and super white (not what you wanted!).

Look at the rocket thrusters for the difference between additive and alpha blend modes

Look at the rocket thrusters for the difference between additive and alpha blend modes

Layer hierarchy and blending control is how you can achieve any kind of special effect in your iPhone game.

I use the SKNode to represent my player, which then has two child nodes: the SKSpriteNode (image) and the SKEffectNode (the particle effect wrapper). Using this structure you can get the same benefits of creating a custom class using the SKNode hierarchy without all the code. 

Inside your didMoveToView() method in your GameScene.swift file, add the following to wrap your SKEmitterNode object in an SKEffectNode object before adding it to your game scene

// The playerNode is the top level object for the main character
//   It composites the image, particle effects, and any other graphics together as a single entity
playerNode = SKNode()
playerNode.position = CGPoint(x: 200, y: 200)
playerNode.zPosition = 5   // The depth should be above any other game objects, but less than any UI
addChild(playerNode)

// Load ship image and display it
playerShip = SKSpriteNode(imageNamed: "PlayerShip1")
playerShip.physicsBody = SKPhysicsBody(texture: playerShip.texture, size: playerShip.size)

// Afterburner - thruster
var playerThrusterPath = NSBundle.mainBundle().pathForResource("Thruster", ofType: "sks")!
var playerThruster = NSKeyedUnarchiver.unarchiveObjectWithFile(playerThrusterPath) as! SKEmitterNode

// Reduce the scale a bit after you play around with the particle effects editor
playerThruster.xScale = 0.5
playerThruster.yScale = 0.5

// Control the composition of the effect (blending) using an SKEffectNode
//  this prevents the white washout with the engine being blended (additive) to the background image
//  you'll see that different colors blend differently as the player moves around.
//  Use this code to fix that issue!
// SKEffectNode's default blend mode is Alpha, so you don't need to change anything to get this to work
//  out of the box.

var playerThrusterEffectNode = SKEffectNode()
playerThrusterEffectNode.addChild(playerThruster)
playerThrusterEffectNode.zPosition = 0  // Below the ship, you could do a flame effect on top for damage

playerThrusterEffectNode.position.y = -20  // move the effect down a bit (based on art/your tastes)

// Make sure you only add the thruster once to the scene hierarchy or you'll see a crash!
playerNode.addChild(playerThrusterEffectNode) 

Try using the code to fix your blending mode glitches – and if that doesn't work let me know.

It can be a little challenging to achieve different visual effects if you don't understand how to composite graphics together in an app or game.

Tutorial Video - How to fix your SKEmitterNode particle effect

 

Want to learn more?

I've been making apps and games for a long time. After working at Apple I decided that I wanted to teach other people how to turn their ideas into apps. If you want to take the first step, but aren't sure where to go – take my iPhone game course.

Posted on March 2, 2015 .