Archive for 'Programming'

Tutorial: MapKit Clustering

Now this is a tutorial you should bookmark for next time you need to display point info on a MapKit map:

How To Efficiently Display Large Amounts of Data on iOS Maps

This tutorial will demonstrate how to handle and display thousands of points of data on an iOS map in a way people understand and enjoy.

We are going to make an iOS app which ships with 87,000 hotels, each with a coordinate, a name and a phone number. This app will never ask the user to “redo search in area”; it will update the map as the user pans and zooms, allowing the user to freely explore the data.

This will require us to come up with an ultra quick data structure built for the task. We will need to build it in C for it to be performant. Once we have constructed our data structure we will come up with a clustering system, as to not overwhelm the user. Finally, we will give it the professional polish that is required for apps to compete in today’s market…

That is one seriously detailed tutorial. Check out the accompanying app at thoughtbot / TBAnnotationClustering!

h/t: iOS Dev Weekly!

UPDATES:

choefele / CCHMapClusterController implements this as a simply usable component.

Open Source iOS Library For Maps WIth Directions, Travel Estimates, Places Search And More

Continue Reading →
0

Monetization: Bitcoin

Now here’s a truly novel approach to monetizing your apps:

New Plugin Allows Developers to Turn iOS Devices Into Bitcoin Mining Bots

Unity plugin developer Icoplay has come up with a new way for developers to monetize free apps on the App Store while avoiding in-app purchases, through the use of bitcoin mining.

Because new bitcoins are generated via complex math problems, Bitcoin mining requires an incredible amount of processing power. Icoplay is aiming to use mining software hidden within apps and games to take advantage of the latent processing power of mobile devices, rewarding the developer with bit coin…

Mind you, the economics don’t seem to make any sense. Checking the latest stats,

Bitcoins Mined — 3,525 BTC

Electricity Consumption — 55,866.44 megawatt hours

we’re somewhere in the range of 16 megawatts per Bitcoin. Takes an awful lot of iPhone 5.5-odd watt-hour charges to add up to one of those. And somewhere in the region of $2300 of electricity. Which would only produce you a couple cents per user-year expected return, at best, and burning out a couple dozen Li-Ion batteries along the way. That would seem to put the usefulness of this somewhere between “laughably negligible” and “wasteful on a scale qualifying as downright evil”.

But hey, if you want to give it shot, check out their FAQ; maybe if you’re really super lucky, you’ll earn enough to buy a coffee in the trendy places around town here sprouting Bitcoin ATMs these days!

h/t: @justinlbaker!

Continue Reading →
0

cocos2d-iphone v3

So the last while you’ve probably come to the conclusion that we’d reached the end of the line for cocos2d as a good development choice, what with the original author dropping support and the introduction of SpriteKit, yes?

Well, not so fast there. The good folk at Apportable stepped up to support continued development of both the library and toolchain, and you can take a look at what’s been brewing away there now:

Cocos2d version 3 preview

The Cocos2d-iphone team, is very excited to share, what we have been working on for the last couple of months; namely the first preview version of Cocos2d version 3.

Version 3 will be the most extensive update to Cocos2d up to this day! This preview is still in alpha, and is not yet meant for use in production. Instead the idea behind the release, is, to collect feedback on the features and API, before everything is finalized.

Together with the release of Cocos2d, a first version of SpriteBuilder is released. SpriteBuilder is developed out of CocosBuilder, with a focus on improved user experience and new features. SpriteBuilder will manage your resources, graphically build your scenes and levels, do your animations, and your particle systems…

There’s a nice demo of SpriteBuilder in this video, “Apportable – One step iOS to Android”:

Compile Android apps directly from Objective-C and Xcode. Watch Zac Bowling explaining ‘Apportable’ and how to create Angry Birds in a couple of minutes using SpriteBuilder.

Yeah, getting to use a tool like and cross-compilation to Android whilst remaining in the friendly … ok, accustomed … environs of Xcode and native iOS development, that’s a pretty solid argument for preferred choice of platform, isn’t it. And there’s a good bit of other upgrading besides, here’s the full highlights list:

  • Starting with version 3, Cocos2d will conform to semantic versioning. This means that point updates will not break backward compatibility.
  • The whole API has received a thorough spring cleaning. Private properties have been hidden, naming is more consistent and old broken or unused classes have been removed.
  • Much improved touch handling. Any node can now handle touches and multiple touches can be handled on a per node basis.
  • Physics has been integrated with Cocos2d and will work seamlessly with your sprites or any other nodes. Best of all, it’s all objective-c!
  • Cocos2d now comes with a UI-kit. Add your buttons, text fields, scroll views or sliders with only a few lines or code.
  • Improved multi-resolution support. With the new positioning and scaling options making your game work on different form factors, such as tablets and mobiles is a breeze.
  • Graphical editor support. Integrated support for SpriteBuilder, where you can lay out all your interfaces, components and even edit your games physics.
  • Much improved truetype labels that support outlines, shadows and attributed strings.
  • Official cross platform support through Apportable. Your games will now compile for native Android without modifications!

All this, and it still runs back to iOS 5. So be sure to keep the cocos2d option in mind when deciding on a platform for your next game!

Continue Reading →
0

cocos2d-iphone v3

So the last while you’ve probably come to the conclusion that we’d reached the end of the line for cocos2d as a good development choice, what with the original author dropping support and the introduction of SpriteKit, yes?

Well, not so fast there. The good folk at Apportable stepped up to support continued development of both the library and toolchain, and you can take a look at what’s been brewing away there now:

Cocos2d version 3 preview

The Cocos2d-iphone team, is very excited to share, what we have been working on for the last couple of months; namely the first preview version of Cocos2d version 3.

Version 3 will be the most extensive update to Cocos2d up to this day! This preview is still in alpha, and is not yet meant for use in production. Instead the idea behind the release, is, to collect feedback on the features and API, before everything is finalized.

Together with the release of Cocos2d, a first version of SpriteBuilder is released. SpriteBuilder is developed out of CocosBuilder, with a focus on improved user experience and new features. SpriteBuilder will manage your resources, graphically build your scenes and levels, do your animations, and your particle systems…

There’s a nice demo of SpriteBuilder in this video, “Apportable – One step iOS to Android”:

Compile Android apps directly from Objective-C and Xcode. Watch Zac Bowling explaining ‘Apportable’ and how to create Angry Birds in a couple of minutes using SpriteBuilder.

Yeah, getting to use a tool like and cross-compilation to Android whilst remaining in the friendly … ok, accustomed … environs of Xcode and native iOS development, that’s a pretty solid argument for preferred choice of platform, isn’t it. And there’s a good bit of other upgrading besides, here’s the full highlights list:

  • Starting with version 3, Cocos2d will conform to semantic versioning. This means that point updates will not break backward compatibility.
  • The whole API has received a thorough spring cleaning. Private properties have been hidden, naming is more consistent and old broken or unused classes have been removed.
  • Much improved touch handling. Any node can now handle touches and multiple touches can be handled on a per node basis.
  • Physics has been integrated with Cocos2d and will work seamlessly with your sprites or any other nodes. Best of all, it’s all objective-c!
  • Cocos2d now comes with a UI-kit. Add your buttons, text fields, scroll views or sliders with only a few lines or code.
  • Improved multi-resolution support. With the new positioning and scaling options making your game work on different form factors, such as tablets and mobiles is a breeze.
  • Graphical editor support. Integrated support for SpriteBuilder, where you can lay out all your interfaces, components and even edit your games physics.
  • Much improved truetype labels that support outlines, shadows and attributed strings.
  • Official cross platform support through Apportable. Your games will now compile for native Android without modifications!

All this, and it still runs back to iOS 5. So be sure to keep the cocos2d option in mind when deciding on a platform for your next game!

Continue Reading →
0

Open Source: Inkpad and Brushes

Well, this is a pretty sweet gift to the iOS world: Steve Sprang has open sourced full fledged drawing and painting apps!

sprang / InkpadInkpad in the App Store

Inkpad is a vector illustration app designed from scratch for the iPad. It supports paths, compound paths, text, images, groups, masks, gradient fills, and an unlimited number of layers.

Inkpad was designed with performance in mind – it can easily handle drawings with hundreds to thousands of shapes without bogging down. Export your finished illustrations directly to your Dropbox as SVG or PDF…

screen480x480.jpeg

sprang / BrushesBrushes in the App Store

Brushes is a painting app designed exclusively for the iPhone, iPod touch, and iPad. Rewritten from the ground up, Brushes 3 is universal — the same version runs on both your iPhone and your iPad. Move paintings between your devices and keep working wherever you go!

An accelerated OpenGL-based painting engine makes painting incredibly smooth and responsive — even with huge brush sizes. Brushes also records every step in your painting. Show off your creative process by replaying your paintings directly on your device…

brushes.jpg

That’s quite the additions to your sample code reference set, ‘tisn’t it now?

h/t: ManiacDev!

Continue Reading →
0

QuickLook Provisioning

Been upset about that QuickLook provisioning profile from a couple years back not working on Mavericks? Why, look here, there’s a shiny new and improved replacement out:

A Quick Look plug-in for Provisioning

Eventually, I decided to write my own Quick Look plug-in and add a bunch of new stuff that I had been wanting to display:

  • Developer certificates: Making it easier to verify that your keychain items match what’s in the profile.
  • Provisioning Profile UUID: When someone on the project team checks in a new Provisioning Profile in the Build Settings, the only information you have is that UUID of that new file. Showing the UUID lets you find the right match.
  • Entitlements: Checking the Push Notification environment, ubiquity container identifiers, and keychain access groups are essential for any app that uses Apple’s services.
  • Links: Whenever the provisioning is broken you spend a lot of time in various sections of the Dev Center. Why not make it easy to get there?

The results of a few days work can be found on GitHub. If you’re lazy like I am, just download the .qlgenerator file and pop it in your Library > QuickLook folder…

Et voilà, all the information you’d been used to getting, much more, and links everywhere:

Screen Shot 2013-11-02 at 7.16.56 PM.png

Kinda needs relabelling “ComprehensiveLook” with all that available, doesn’t it now? Big round of applause for Messr. Hockenberry!

Continue Reading →
1

UI Pattern: Float Label

This is a nice bit of clever for more elegant layout of your form entry screens; have the placeholder text animate into a label!

How the Float Label Pattern Started

I first had the idea for a new input pattern back in August. The idea was simple enough – animate placeholder text to show an icon beside the input so you don’t lose your context. I’ve been doing 99% mobile work for the past 2 years and little things like this can really add up. I wanted a solution that saved space, looked clean and clear, but didn’t forego usability…

… I designed a new version using text only, plus a slight animation for the float label. I spent a long time thinking about the micro-interactions of when the active color would change and how soon would the text animate after someone typed. These were tiny decisions made down to the very last keyframe in my 30 FPS file.

Screen Shot 2013-10-31 at 7.08.44 AM.png

… A few days later a long time Twitter friend, Jared Verdi, busted out the first real implemenation in Obj-C. Super cool. Somehow Jared’s github post blew up a bit and everyone seemed to be tweeting about it. Thankfully he named it something cool when he first implemented it because I never did – JVFloatLabeledTextField. The “float label pattern” was born.

And people who struggle with the design space on small screens — oh, wait, that’s everybody — are finding the concept of great interest; check the ‘Resources’ section at the bottom of that post and you’ll find links to proof of concepts in a variety of environments. Specifically to try it out in iOS at the moment, you have:

jverdi / JVFloatLabeledTextField — the original UITextField POC described above

iwasrobbed / RPFloatingPlaceholders — UITextField and UITextView versions

h/t: ManiacDev!

Continue Reading →
0

Animation Helpers

So what with animation becoming more of a thing in the brave new flat interface world, it behooves us to know a little more about it than we’ve probably bothered to so far, and there’s a really great read on it here (h/t: iOSDevWeekly):

Controlling Animation Timing

There is a protocol called CAMediaTiming which is implemented by CAAnimation, the base class of CABasicAnimation and CAKeyframeAnimation. It is where all the timing related properties – like duration, beginTime and repeatCount – come from. All in all the protocol defines eight properties that can be combines in a number of ways to precisely control timing. The documentation is only a few sentences per property so you could probably read it all and the actual header way faster than this article but I feel that timing is better explained with visualizations…

If you like the SpriteKit action paradigm, and wish Core Animation had something like it, why look here (h/t: @romainbriche):

CodaFi / CFAAction — Core Animation Actions in the key of SK

CFAAction is a wrapper around several common Core Animation animations that provides additional modularity and the ability to group and sequence actions.

CFAAction’s should be treated like SKAction’s, which means they are only run when they are submitted to a variant of -[CALayer runAction:]….

And if you want some really easy keyframed animation, check out (h/t: iOSDevWeekly):

IFTTT / JazzHands – A simple, keyframe based animation framework for UIKit.

Jazz Hands is a simple, keyframe based animation framework for UIKit. Animations can be controlled via gestures, scroll views, kvo, or ReactiveCocoa…

Currently, Jazz Hands supports three types of animations:

  • IFTTTFrameAnimation moves and sizes views.
  • IFTTTAlphaAnimation creates fade effects.
  • IFTTTHideAnimation hides and shows views.

And don’t forget our Grab Bag: Graphic Tweaks post for other stuff along these lines we noted over this last year, a good bit of it is still at least somewhat relevant.

UPDATES:

iOS 7 Tutorial Series: Introducing UIKit Dynamics

iOS 7 Custom transitions

Extensive UIKit Animation Library Allowing Block Based Animations, Spring Animations And More

Clear Animation Code

Continue Reading →
0

iBeacon Sightings

Today let’s take a look at what’s happening with one of the sleeper features of iOS 7: iBeacon! If you’ve managed to miss it so far, it’s Bluetooth microlocation broadcasters to supplement the accustomed location methods. No particularly big changes API-wise, a few new Core Location and Passbook methods, but it does have some rather interesting potential:

How Apple’s iBeacon Could Upend Retail Shopping

Forget about QR codes, NFC technology, kiosks, and tablets as the major game changers in retail; introducing iBeacon and Bluetooth Low Energy technology to our everyday retail experiences is like introducing the Flintstones to the Jetsons shopping mall…

Apple’s Location-Tracking iBeacon Is Poised for Use in Retail Sales

For retailers desperate to turn smartphones from distractions into a sales tool, it provides a quick way to target ads and other messages to consumers as they walk through a store. For Apple, it’s a chance to collect valuable shopping data and to build a mobile-payment platform into a dominant retail standard. Apple declined to comment. “IBeacon’s momentum is just getting started,” says Hari Gottipati, an independent tech consultant in Phoenix, “but it’s going to explode faster than anyone can imagine.”

How Apple iBeacon Will Transform Local Commerce

… iOS7 and iBeacon create an ecosystem-wide network effect overnight, with standard technology, offered in an open development environment. It’s very clear that Apple is starting to put the pieces together to allow consumers to make offline transactions with their device..

Apple Feature to Turn MLB Stadiums Into Interactive Playgrounds

Major League Baseball is launching a major initiative to make attending games at stadiums a completely interactive experience for fans.

Taking advantage of Apple’s iBeacon indoor mapping, a new feature in iOS 7, the MLB plans to customize its At the Ballpark app for everyone that walks into any of its stadiums nationwide…

iOS 7 iBeacons: Everything You Need To Know

S**t just got real.

Indeed.

So where can you pick up some hardware to try this out? Here’s a few links to start:

Estimote Beacons – real world context for your apps

Kontakt – Build your own iBeacon micro-location app in less than an hour

KST iBeacon [Alpha Program Participants Only!]

Roximity iBeacon – Take full advantage of iPhone’s new iBeacon framework, simply.

Twocanoes’s Bleu Station

How to Make an iBeacon Out of a Raspberry Pi

Or, if you’ve got a spare recent-ish device sitting around, there’s the Estimote Virtual Beacon app to get started now.

Source code and tutorials:

WWDC 2013 Sample Code’s AirLocate “shows how to use CLLocationManager to monitor and range CLBeaconRegions.”

iOS 7 Tutorial Series: Core Location Beacons

Dave Addey’s iBeacons overview

nicktoumpelis / HiBeacons “can be used to demonstrate both beacon advertising and ranging”

ohwutup / OWUProximityManager – “Detect and connect to nearby devices with iBeacons and CoreBluetooth.”

Estimote / iOS-SDK has Distance, Proximity, and Notification samples, described in their API Documentation.

UPDATES:

lgaches / BeaconEmitter: “Create an iBeacon with your MacBook.”

Can you Smell the iBeacon?

iOS Component For Creating A Pulsing Animation Great For Map Annotations And Beacons

iBeacons Used To Deliver Location-Based Access To iOS Newsstand Publications

How iBeacons could change the world forever

Reverse Engineering the Estimote

iBeacon Could Be Apple’s Secret Gaming Weapon, Developer Says

4 Reasons Why Apple’s iBeacon Is About to Disrupt Interaction Design

Continue Reading →
0

SpriteKit Smorgasbord

So, you’ve probably heard about this new SpriteKit thing in iOS 7, right? If not, here’s the elevator pitch:

Sprite Kit is a powerful graphics framework for 2D games such as side-scrolling shooters, puzzle games, and platformers. A flexible API lets developers control sprite attributes such as position, size, rotation, gravity, and mass. Sprite Kit’s OpenGL-based renderer efficiently animates 2D scenes. Built-in support for physics makes animations look real, and particle systems create essential game effects such as fire, explosions, and smoke. To assist SpriteKit-based game development, Xcode supports texture atlas creation and includes a particle creator.

Pleasant change having all that in your OEM toolkit, isn’t it? Here’s what you have for documentation:

Sprite Kit Programming Guide

Sprite Kit Framework Reference

Texture Atlas Help

Particle Emitter Editor Guide

code:Explained Adventure

SpriteKit Physics Collisions

Sprite Tour

The next question is, why would we decide to use anything else? Well, let’s see what Ray Wenderlich thinks:

Sprite Kit Tutorial for Beginners

After this a lot of you may be thinking, “Well, which 2D framework should I choose?”

The answer that depends on what your goals are. Here’s my 2c:

  • If you are a complete beginner, or solely focused on iOS: Use Sprite Kit – it’s built in, easy to learn, and will get the job done.
  • If you need to write your own OpenGL code: Stick with Cocos2D or another option for now, as Sprite Kit does not currently support this.
  • If you want to be cross-platform: Choose Cocos2D-X or Unity. Cocos2D-X is nice because it’s “down to the wire”, built for 2D games, and you can do just about anything you want with it. Unity is nice because it gives you more flexibility (i.e. you can add some 3D aspects into your game if you want), however you have to go through a few more hoops to make 2D games.

The first two are gimmes, but the third takes a bit more thought. How’s your C++ or C# skills these days? You anywhere near as productive with either as in Objective-C? Make sure you factor that into your decision. How much of everything you want to do is actually cross-platform, and how much is going to require platform-specific work no matter what you do? How much extra time are you going to spend in the write once — debug everywhere loop? And what benefit are you actually going to get from jumping through all those hoops?

Around these parts, we’re solid advocates of doing whatever is fastest to get your MVP out, which means one platform, with all the latest labor-saving APIs. If it’s a hit, you’ll have plenty of money to hire people who know their stuff tp port it for you and/or write version 2 in a cross-platform manner while version 1 finances it. If it’s not … well, better you found that out before wasting more time and money on a cross-platform release, isn’t it? Make your own incremental revenue vs. extra resources invested vs. opportunity cost of delay model, and work it out for yourself. We’re pretty confident the ‘quick as you can with the least investment possible’ strategy comes out top under virtually all reasonable assumptions.

And just to put some sweet icing on that opinion cake, consider Apportable: cross-compile your iOS app for Android — surprisingly close to working last we tried it, and getting better all the time so we hear. And really, what other platform is worth any effort at all? Why, none worth even considering making part of your core competency, that’s our answer.

If that makes sense to you, and it should, consider doubling down on the iOS-first bet and going with Steffen Itterheim’s Kobold Kit:

Features and Requirements

Kobold Kit adds the following features above and beyond what Sprite Kit offers.

Add that up with their partnership with Apportable, and you’ve got a pretty interesting rapid development framework for the iOS-centric programmer.

Compelled yet? Here’s some more reading:

iOS Games by Tutorials is another Wenderlich team epic, and the best $54 you’ll spend getting up to speed. If you’re not that certain yet, of course there’s free tutorials in abundance:

Sprite Kit Tutorial for Beginners

Sprite Kit Tutorial: Animations and Texture Atlases

Sprite Kit Tutorial: How To Drag and Drop Sprites

How To Make a Game Like Space Invaders with Sprite Kit Tutorial: Part 1 and Part 2

Procedural Level Generation in Games Tutorial: Part 1 and Part 2

Sprite Kit Tutorial: Making a Universal App: Part 1 and Part 2

Here’s some other notes and samples worth flipping through:

SpriteKit Animations and TextureAtlasses describes how the always-awesome TexturePacker is a nice upgrade to the Xcode workflow

2D Game Development With SpriteKit — source at ChrisGrant / FirstSquadron

Spritekit Particle Fun — source at 7sharp9 / SpriteKit-Fsharp-Samples

iOS 7 Sprite Kit PhysicsDebugger

How I Went From 0 to Game with Sprite Kit in iOS 7

iOS 7 Sprite Kit: My Top 5 Pros and Cons

Sprite Kit vs. Cocos2D

Free Sprite Kit Video Tutorials

Use SpriteKit to Give Your iOS 7 Menu Some Animation!

sprite-kit.com aims to be “a central hub of tutorials, books, open source projects and various assets for developers working with Sprite Kit”

and search Github for other tidbits too!

UPDATES:

iOS 7 Tutorial Series: Introduction to Sprite Kit

Sprite Kit Tutorial: Space Shooter

Using Glyph Designer with Sprite Kit

SKPhysicsBody Path Generator

Open Source iOS Sprite Kit Helper Library That Makes Performing Common Behaviors Easier

iOS Library That Uses Swizzling To Draw Physics Bodies Makes Debugging Sprite Kit Physics Easier

Custom drawing in SpriteKit

Integrating Spine with SpriteKit Tutorial

SpriteKit Animations and TextureAtlasses

Airplay Tutorial: An Apple TV Multiplayer Quiz Game

Sprite Kit Tutorial: How to Make a Platform Game Like Super Mario Brothers – Part 1

Sprite Kit Helper Library Adding Support For Tileable Textures, Easier Animations And More

Continue Reading →
0
Page 3 of 93 12345...»