This is just a quick reminder that the iOS8 Feast is ending this Wednesday. On the 22nd of October our big giveaway will happen and raywenderlich.com will give prizes of $12,000 value to a number of participants.

Getting part and increasing your chances of winning is very easy just re-tweet the giveaway announcement!

 

 

The iOS8 Feast is a month long celebration of the release of iOS8 – during that month the team at raywenderlich released all our new books and the updates to our existing learning materials.

The iOS8 Feast overview

Swift_125x125

On the 17th of September we released Swift by Tutorials – a brand new book to teach you everything you need to know to start writing Swift applications.


iOS8_125x125

On the 24th of September we released iOS8 by Tutorials – the book that covers in details all new APIs in iOS8. All in Swift, all awesome.


ad_iGT_250x250

On the 1st of October we released (my favorite) update – the second edition of iOS Games by Tutorials – a fully re-written in Swift and re-imagined for iOS8. We worked hard on iOS Games by Tutorials 2nd Edition to add a full introduction to Scene Editor, Playgrounds, and all new APIs in the iOS8 release


iOSApprentice_125x125

On the 8th of October (and throughout the iOS8 Feast) – Matthijs from the team has released updates to all four parts of the iOS Apprentice – the book to teach absolute beginners developing for the iPhone in Swift.


CoreData_125x125

Finally on the 15th of October Core Data by Tutorials came out – a brand new book about programming with Core Data in Swift. The first Swift Core Data book out there!

So – it’s been a fantastic month for all of the authors on the raywenderlich.com author team. And those $12,000 in prizes are waiting for the lucky winners, it’s not too late to send a tweet and get a chance to win some!


Marin’s honest speaking advice

Before I started speaking at conferences I carefully read through a lot of advices on the Internet, and it really seems like lots of people wanted to give some on their blog. There was even somebody who created a while ago a site about speaking advices (http://speaking.io)

It’s been a while though and after I spoke at few events I realized that most of what I read didn’t apply to me at all (and I doubt it applies to many), so I thought I’d round up some advice list of my own.

Hopefully it’ll help people who just start speaking or want to start doing that.

Disclaimer: Those below are strictly based on my experience, they might apply/be relevant only partially or not at all to your case.

The event

  • Topic: You need to talk about something that is relevant to the general conference topic. Speaking specifically about iOS or Android on a Mobile conference is fine, but showcasing CSS hacks on a Geolocation event is a recipe for trouble – people most probably won’t understand it and when they do that they’ll be bored.
  • Location: Local events are very different than international events. For me local events are about showing off who’s doing better between competing companies – I don’t need any of this, because I don’t care. I like international events – I find that people there are coming over most often to do networking and have fun. And I care about those :)
  • Type: Conferences with 100+ attendees are fun – so much fun! And you get to meet tons of people, and everything happens pretty randomly. On a smaller scale event – say if you are a guest speaker at a local meetup of 20 people you might expect to be treated as “the guest”, have dinner out with few guys, etc. Choose your flavor.

Your presentation

  • Topic: Please present on a topic you feel comfortable with. I was on an “event” where somebody from the first row kept correcting the presenter and that was a disaster. That was a free event so let’s say it was kind of okay, but for an event where people pay money to attend – presenting wrong facts is a no go.
  • Presentation intro: A lot of people start their presentation with a number of slides that describe who they are and what they did: “I was born here and here, graduated in top 10 of my class, I worked on this and that app, …”. Believe me – nobody wants to know this. At least not before you presented anything. People are already sitting in front of you, they are already sold on you and your talk, don’t bore them with the story of your life, but get to the topic they came to learn/hear about. Put 1 slide with your name in big letters, and a second slide with the 1 thing or 2 things you want to tell about yourself, and move on to your topic.
  • Presentation outro: Again – lot of people would have a slide with lots of code as their last one and then cut to an empty screen that says “Fin” or “The End” then cross their hands and ask “Questions?”. Don’t do that. Remember you skipped on long introductions? Now is the time to ease the audience out of your talk. Say that’s the end and move on to a couple of slides about yourself or your product. Include a URL or Twitter handle, or a QR code and leave that slide on screen. People who are interested in the topic will notice and get in contact with you. But please – leave the slide with your contacts on screen, during questions and all.

Presentation format

Your content format depends strongly on what you present but here are some advices based on what I’ve done or seen in the past.

  • Code samples: I’ve seen presentations that start with 5-6 slides about the presenter and his whole life and then just switch to an infinite amount of slides that are full of source code top to bottom. Tips & tricks rarely works as a presentation. I’ve seen some that were okay, but tips and screens full of code are a recipe for people just pulling their laptops and start checking mail.
  • Live coding: I’ve seen many times people say that live coding is a NO NO NO. My own opinion is that live coding is YES YES YES. Yes it can go wrong, yes the wifi can go down, yes you can make a mistake. Just rehearse everything few times at home, have the source code starter AND completed project prepared, and make sure you talk to the organizers how important is for the connection to work, and tell them exactly what you will do. That’s it – when in the end things work out the audience will be very happy – I promise.
  • Workshops: If you stay in front of a group of people and show them stuff on screen – it’s not a workshop. In a workshop people do stuff themselves and you help them out (if needed, usually people are smart enough to figure things out – and that’s what makes it fun for them). What I’d do is to have a 20% – 25% of the time at the beginning to present the basics on the beamer, live code a bit, and then put people to do stuff themselves. I’d put task instructions on screen – sometimes just spelling the code other times describing what the code would do and let people figure it out.

The community

  • Questions: Very few people can attend a presentation and then come up with an interesting question right away. On my talks I usually try to take 2 max 3 questions, and I’d wrap it up. But I always make sure to say that I’m there the whole day, and I want to talk to everyone about the presentation topic or anything else. And then I do hang around just in front of the hall where the presentation was or in the lobby, so that I can actually meet people while they are still excited about what I presented.
  • Speakers: The other speakers on the event are some of the people you really want to network with. After all – you have a common interest (speaking) and they tend to be quite interesting guys (they got invited to speak after all). If there’s a speakers’ dinner or so make sure to get to know as many people as you can. It’s tons of fun!
  • Douchebags: You will meet some of them. A bunch of guys on an ego trip – just released their website or first app last year, and this year they are all over the place trying to show how much they don’t care. You’ll recognize them fast – they are usually in a little group, they don’t attend any of the other speaker’s talks, and their presentation are basically a pitch for their app. Just ignore those guys, they’ll never say “hi” or so anyway. (Brutally honest I know – this is what this article is about after all)

The presentation software

  • Keynote: I personally love Keynote. It’s easy to create shapes and diagrams, to import and edit images, and they have some very simple themes that you can use for just anything. In the end it’s not the presentation theme, the fonts, or the colors – it’s your content that is important. And Keynote allows me to create content very fast, which is important for me. Additionally I use often (especially for workshops) animations in Keynote – they allow me to introduce a complicated concept piece by piece, demonstrate animations we are about to build, etc.
  • Deckset: It’s getting popular with speakers lately, you can give it a try too. I’m not a big fan since their themes are very recognizable and on a conference where more speakers use that app presentations tend to seem visually similar. (Which is not a problem with simple theme, but with a special font/colors it jumps in your eyes every time) It’s an interesting idea anyway – you can use Markdown to quickly create simple presentations if that’s your fancy.

Bonus: Speaker’s essential pack-list

Okay here are the essentials you really don’t want to leave home:

  • your laptop obviously – it has your presentation, and your email
  • adapter – if you fly overseas check if you can use your plugs or you need a converter
  • mini-DVI to VGA – you’d be surprised but some events don’t have one for you, so bring yours just in case
  • remote control – that depends, I personally can present also without it, but if you can’t – don’t forget it
  • business cards – believe it or not, it’s still the easiest way to exchange contacts. Not cards of your employer though, your own personal cards
  • cash – check if the country you fly to generally accepts cards, if not you’ll need to carry cash around with you (don’t laugh – in some European countries you simply can’t pay with credit cards)
  • usb stick – keep the most important files on a stick. You’ll be happy about it if the wifi fails you
  • good mood – yay! you’re speaking! you’re gonna have great time :)

Alright … that’s all I’ve got for now. Hopefully you’ll find this list helpful. Write a comment or email me if you have any comments, feedback, or some extra advices.

Cheers, Marin


Book: iOS8 by Tutorials

As every year ever since iOS5 also this year the ray wenderlich tutorial team has prepared a book to teach you the new APIs in iOS8. Available at iOS8 launch the book goes in depth to unravel the mysteries of:

  • Adaptive UI with Size Classes, Universal Storyboards, and more
  • App Extensions
  • Cloud Kit
  • Xcode 6 and the new development tools
  • TestFlight integration
  • Handoff
  • Visual effects, and more

14 of the best authors on the tutorial team worked together to produce an almost encyclopedic coverage of the new APIs in iOS8. You can read end to end to become an iOS8 expert, or you can just focus on the chapter, which are of immediate interest to you, and leave the rest as a quick reference for later on.

The book covers all the latest tech: iOS8 APIs, Xcode 6, and Swift.

iOS by Tutorials is a part of a 3 books bundle, all written by the fantastic authors from the ray wenderlich tutorial team, which teaches everything about iOS8 and Swift. The bundle includes Swift by Tutorials, iOS8 by Tutorials, and Core Data by Tutorials. All books covering the latest tech: iOS8 APIs, Xcode 6, and Swift. Last but not least: you save off the books price if you buy the bundle!

To learn more about Swift by Tutorials and the book bundle visit this page: www.ios8-by-tutorials.com

Or click this banner and go straight to the book store to buy instantly the 3 book bundle:

banner_380x200


You can clone this project from GitHub!
This post features open source code, which you can find on GitHub.
After you done with the tutorial don't forget to check out the repo at https://github.com/icanzilb/OneShotLocationManager
Working easily with location in iOS8 and Swift with OneShotLocationManager

Since CLLocationManager doesn’t support block based APIs sometimes it’s very annoying to setup a delegate and implement all delegate methods if you just want to fetch the current location once and that’s it.

OneShotLocationManager is a class that solves that problem in Swift. Whenever you need to fetch the current device location you just need to create an instance of OneShotLocationManager and call the method to fetch a location. It will request the necessary authorizations and return the current location. Very easy. It just works.

Using OneShotLocationManager is really very easy since it’s supposed to do just one thing – fetch the current location and give it to you.

Let’s have a look at how to use it in a sample app.

Creating an Xcode 6 app that uses location

Using location in iOS8 works a bit different compared to how it used to work in iOS7 and earlier. It’s not much different in the end and it actually boils down to these few changes:

  • you need to ask for specific permission – either to use location when the app is in the foreground only, or always – i.e. in foreground and background
  • you need to add to your Info.plist a description what do you need the location for
  • once you get the proper authorization from the user you work with CLLocationManager as usual

So let’s create an Xcode6 app and configure it to work with location data.

Open Xcode and from the main menu select File/New/Project…, select the iOS/Application/Single View Application project template and click Next. Call the project LocationDemo, make sure the selected Language is Swift and click Next.

Finally save the project somewhere on your disc. Now you have the empty project ready. In this project you are just going to fetch the current location so you won’t add any UI to the storyboard.

Now let’s add the location permission description that the app will use to ask the user for authorization.

Select the project file LocationDemo in the File Navigator, then make sure the proper project target is selected – LocationDemo, and then select the Info tab.

xcode_infotab

Here you need to add the extra key for the location permission description. Hover with the mouse over the first item and in a second a “+” and “-” buttons will appear. Click the “+” button to add a new item in the Info.plist file.

infotab_addbutton

As name of the new item enter “NSLocationWhenInUseUsageDescription” and as value enter the text “We need to know your location to show you the coordinates where you are located“. In your real apps you need to be more informative why do you need the location information but for the this demo app this will have to suffice.

infotab_locationkey

Okay, that’s a wrap with setting up the Xcode project. Now let’s grab OneShotLocationManager from GitHub and add it to your project.

Import OneShotLocationManager

At the moment of this writing ther’s no better way of distributing Swift libraries but just copying over the source code to your project – so let’s do exactly that. Open the GitHub repository page of OneShotLocationManager https://github.com/icanzilb/OneShotLocationManager and to the bottom right find and click the button saying Download ZIP.

oneshot_github

From the unarchived folder grab OneShotLocationManager.swift and drag it into your Xcode project. When asked check “Copy items if needed” to include the source file in your own Xcode project and click Finish.

You’re now ready to use the class.

Easily fetching the location via OneShotLocationManager

You’re finally to write some code.

Open ViewController.swift from your Xcode project. We are going to add the location code in the view controller – just to learn how to use the class. In your own apps you can put this code whenever your app architecture requires you to.

First add a new variable to the class (add it just under the line where you declare the ViewController class):

This is the variable you will use to keep an instance of the manager while it fetches the location for you. Now you are going to add a new method to fire just after the view controller shows up its view on screen:

Your first task, of course, is to create a new instance of the location manager. Add at the end of viewDidAppear:

First you create a new OneShotLocationManager instance and then you call fetchWithCompletion on it. fetchWithCompletion will check the location permission authorization status and if you have never granted this app location permissions will ask the user for permissions. Once permissions are granted will fetch the current location and invoke the given code closure.

The two parameters, as their names suggest, will give you the current location or the error that arised when the class tried to fetch a location.

Now let’s add some code inside the closure to handle the response:

Inside the closure you try to unwrap the first parameter (location itself is an Optional – CLLocation?) – if the unwrap succeeds the operation was successful and you can use the location constant. Otherwise you try to unwrap the error parameter which is of type NSError? and see what kind of error you have on your hands.

You can check the code property on the error object for more details. If you look into OneShotLocationManager you can see some of the errors that you might get defined in the OneShotLocationManagerErrors enumeration:

Okay – one last step. Immediately after you have received result from the location manager, no matter if it’s an error or a location, you don’t need the OneShotLocationManager instance anymore – you can’t use it to try fetching a location second time.

So, still inside the closure, get rid of the manager instance:

In case you are using the iPhone Simulator to test this app you need to tell Xcode to simulate some location data for you. From Xcode main menu select Product/Scheme/Edit Scheme.

In the Edit Scheme dialogue do the following:

  1. Make sure Run is selected on the left
  2. Then check the checkbox saying Allow Location Simulation
  3. Choose as Default Location Tokyo, Japan

xcode_simlocation

Okay – all done! Build and run the the project. In the alert that pops up immediately after you start the app you can see the text you set in Info.plist:

alert_location_auth

Click Allow and check the Output Console in Xcode you should see the location object printed like so:

console_location

Success!

Where to go from here?

You can download the completed project here.

If you want to learn more about working with location data in iOS8 with Swift you should check out my colleagues’ new book called iOS8 by Tutorials.

In case you want to learn more about Swift – I recommend Swift by Tutorials.

And if you want them both and more, they have also a book bundle about Swift and iOS8 which gives you a discount on the book prices.

banner_380x200

And don’t forget this whole month is the iOS8 Feast on raywenderlich.com – we have a contest running and a prize pool of more than $10,000 value! You can participate with a single tweet too. Check out the iOS8 Feast – look for the tweet button.


Book: Swift by Tutorials

By the renowned authors from the ray wenderlich tutorial team – Colin Eberhardt and Matt Galloway comes the definitive introduction to Apple’s new programming language – Swift by Tutorials. A brand new book which comes out synchronously with the official release of iOS8 and teaches you everything Swift. Learning Swift is quick and easy – just […]

It seems everybody is in love with Swift, but since Optinals are a rather advanced concept the Swift code I see published on the Internet tends to rather randomly unwrap Optionals. And to be honest I haven’t seen a good blog post to clearly explain in plain text when to unwrap in what way. So […]

RwDevCon – a raywenderlich.com conference in Washington, Feb 2015

After a truly long consideration and secret planning, scheming and speculation, dreaming and cold feet, heated discussions and planning – it has come to this: our very own conference! The ray wenderlich tutorial team will hold a 2 day conference in Washington early next year, namely the February the 6th and the 7th. You can […]

This year I am to speak again at the Pragma Mark conference in Milano, Italy.I had great time last year and when they asked me to do a half a day workshop this year I agreed in a whim. I been hard at work this whole summer and have written tons of Swift and Sprite […]