Sunday, June 28, 2015

Swift use of optionals

In learning swift the question mark or the exclamation point and when to use them can be confusing for the beginner. I found an article that really does a good job at explaining this point.

http://www.touch-code-magazine.com/swift-optionals-use-let/
For example if those pieces of data represent an employee profile in a company database, for some records you might not know the height of the employee – in that case you shouldn’t set a value of 0 – you really should rather set the value to nothing or missing.


...


When you put a ! behind the property name you tell the compiler I don’t care that this property is optional, I know that when this code executes there always will be a value store so treat this Optional like a normal datatype. Well isn’t that nice? What would happen though if there isn’t a navigation controller to your view controller? If you suggestion that there always will be a value stored in navigationController was wrong? Your app will crash. Simple and ugly as that.


Saturday, June 27, 2015

Mobile Application Programing: iOS Lecture I

I am continuing with  Mobile programming iOS  with Matt Stoker I read some of  - Apple's Introduction to Swift.





He has developed MobileFinder/Studio

On to Week 1 demo and presentation 

Companies target iOS platforms before they do Android.

Xcode starts around the 43 minute mark

Starting with Single View Application








Right click project, show in finder

As you add files, the build phases tabs adds the files to compile:




Images.xcassets - different pixel densities

Info.plist - metatdata about the project


For now, remove story board file.


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {


    var window: UIWindow?


class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.

    }




        window = UIWindow(frame:UIScreen.mainScreen().bounds)
        window?.makeKeyAndVisible()
        window?.backgroundColor = UIColor.greenColor()
        
        
        let lightView1 = UIView()
        lightView1.frame = CGRectMake(40.0, 50.0, 200.0, 100.0)
        lightView1.backgroundColor = UIColor.blueColor()
        window?.addSubview(lightView1)
        
        
        
        let lightSwitch = UISwitch()
        lightSwitch.frame = CGRectMake(200.0, 250.0, 100.0, 200.0)

        window?.addSubview(lightSwitch)







Screenshots

I take more screen shots than the average Joe. A picture in my mind is worth a thousand words. I have seen it so many time in technology shops that a simple screen shot will save so many back and forth email exchanges,  and possibly meetings.

With mobile phones, it is so easy to do so and once you get the hang of it, you'll find yourself sending screenshots all the time.

On a Mac , I always forget the keying sequence to do so. So here its is.



Wednesday, June 24, 2015

Rays Newsletter June edition



Yesterday, I recived Ray Wenderlich's June newsletter in my inbox. This was the same afternoon that iOS Beta 2 arrived OTA on my phone. So, I was already up and running when I saw he had a post on upgrading to iOS 9.

Likewise, he has a top ten WWDC 2015 videos.
http://www.raywenderlich.com/108816/top-10-wwdc-2015-videos


Here is a series of trainings on iOS
https://www.youtube.com/user/SkipCasts/videos

I continue learning Swift. Here is a cheat sheet
http://kpbp.github.io/swiftcheatsheet/

Monday, June 22, 2015

Who knew people camped out for the Keynote


A 17 year old scholarship winner for WWDC 2015 goes over his experience.

What struck me was the fact that people actually camp out for good seats at the WWDC keynote talk:

some people started lining up for the keynote at 5 p.m. Lining up at 10 p.m. will get you in the first 20 people though. If you want to have a good seat, it is a good idea to start lining up before 3-4 a.m. It would be cold at night, so remember to bring layers of clothes, a blanket, a chair or anything to keep you warm. While waiting, you would see companies hand out free stuff. I got some hand warmers and pizza. At around 7 a.m., you start going in Moscone. It gets really packed, and everyone is pushing up against you. At this point, there will be people cheating and climbing over the rails to get on the other side near the door. Once through the door, you go up some escalators. They tell you not to run, but everyone does. Once up the first escalator, be sure to stay on the right side. The right side goes up the right escalators, which leads to the right side of Presidio. The best seats are at the front, to the right. The middle space at the front is reserved for the press and people who work for Apple. After you get up the first escalators, you will have to wait near the second escalators for around two hours. You can get some food and take some rest. After an hour of waiting at Presidio (and after you get seats), the keynote starts. Don’t leave your seat while waiting because someone may take it.

Sunday, June 21, 2015

Mac Basics


The course mentioned at WWDC 2015 was iOS Development in Swift by Plymouth University.

First time mac user tips Part 1
windows:

  • Minimize 
  • Maximize - hold down alt press the +, or just press it and it goes in full screen mode
  • Hide - Cmd H
Part 2
Finder - menu  at top for currently selected window

Finding applications - Finder

Applications
    -> Utilities
Cmd up arrow go back up in menu directories


Launchpad

There is search box.

Within launchpad:
  • cmd shift - A  - applications folder
  • Cmd shift  H-  Home folder
  • Cmd shift - W - dismiss window 
  • Cmd -space - spotlight search
Xcode shortcuts ( cmd , alt alternative functions, control less used)
page down cmd arrow down
page up cmd arrow up
copy cmd c
paste cmd v
cut cmd x
undo cmd z

function keys debugging
breakpoint in code
f6 step over,  if doesnt work use fn key along with key


apple menu at top - system preferences - keyboard
checkbox to not need fn button

app preferences
xcode -> preferences
downloads

simulator - cmd left arrow rotate it, see menus for simulator for more, can reset contents and get default state


multiple desktops
i.e. see documentation
applications folder -> mission control, can click plus and add additional ones
move simulator different desktops
ctrl Rt Arrow or ctrl Lft Arrow switch desktops
System preferences + hot corners

https://github.com/SoCM/iOS-FastTrack-2014-2015

copy folder into  unix terminal











Saturday, June 20, 2015

Apple Readings June 20th edition

From Apple via  ITunes U, there now exists a web site on Git Hub with course materials on teaching Swift.

Here is s sample from website http://swifteducation.github.io/assets/pdfs/XcodeKeyboardShortcuts.pdf

http://asciiwwdc.com/search?q=swift+2

An Introduction to Protocol Extensions blog post

Some commentary on Swift 2 error handling

I just upgraded to El Capitan . Here is what i can look out for.


Based on this article,  looks like iBeacons jumped the shark.


A developer blog with 18 articles so far on Swift.

XCODE7 Beta  a first of its kind allowing you to develop without the price tag :


Until the new beta came out, Apple required developers to pay to become members of Apple's Developer Program before apps could be distributed beyond the developer's local machine, or tested on physical iOS devices -- a local iOS emulator for the Mac was always available, and could be used to test apps without a developer account. While the cost was modest at $99 per year, some developers -- including those who intended to build free apps, those who were new to the process, and students or impoverished potential developers -- often balked at the cost.

The "Best of" Swift2


http://developingperspective.com/2015/06/08/0/


Magic Trackpad

The Magic Trackpad  (model number A1339) is the trackpad by apple that makes use of Apple's Multi-Touch  technology.

Scroll - two fingers
two finger swipe - go back
Switching Apps with four fingers across
control button- two fingers zoom in or out
Four fingers down - expose mode
Four fingers up - clear desktop

This video goes over features by Soldier Knows Best:






https://www.youtube.com/watch?v=GF5IPPrx17A

Sunday, June 14, 2015

Learning Swift From Scratch

I am starting my journey with Swift programming. Although, over the past few years I have dabbled a little with objective C programming and iOS. Just recently, I came across a university taught course on Mobile programming with Swift.

This course starts out with a reading assignment - Apple's Introduction to Swift.  Before I get started, I want to touch on that I am in Apple's developer program.  This now includes resources for Mac OSX, iOS, and WatchOS.  I am going to upgrade to latest version of Xcode before i get started. On the downloads page I can find they have Xcode 7 beta available which I will try out. They talk about the features including Interface Builder on the Xcode page. As well, the Swift now is at version 2.

Apple in 2004 released a book on Swift Programming Language. One more resource I came across is free book on basics from ibooks store from apple. The corresponding web site is http://swiftcenter.net/ . Lastly, an ebook on Swift you can buy.

Saturday, June 13, 2015

Swift2

I just heard about Swift2 being introduced at the WWDC 2015.



 It's open sourced as well. As well,  the individual Apple developer accounts (Mac, iOS, and WatchOS) are being merged into one.



https://developer.apple.com/videos/wwdc/2015/?id=106

http://techxpatspodcast.com/2015/06/11/035-wwdc15-keynote-roundup/

http://www.appcoda.com/tag/swift2/  intro

http://www.hackingwithswift.com/swift2

http://natashatherobot.com/swift-2-error-handling/

http://www.sunsetlakesoftware.com/2015/06/12/swift-2-error-handling-practice

http://www.macworld.co.uk/how-to/mac/how-get-started-with-apple-swift-programming-3523633/

http://jamesonquave.com/blog/swift-2-whats-new/



You can't touch it - yet

The Force Touch trackpad is different than anything we have seen in the past and it is front and center with the Apple watch watch:
Apple Watch senses force, adding a new dimension to the user interface. Force Touch uses tiny electrodes around the flexible Retina display to distinguish between a light tap and a deep press, and trigger instant access to a range of contextually specific controls. With Force Touch, pressing firmly on the screen brings up additional controls in apps like Messages, Music, and Calendar. It also lets you select different watch faces, pause or end a workout, search an address in Maps, and more.

Using a Force Touch trackpad . So many gestures to learn. Such as ones here:


  • When you Force Click on a word in a browser, it will automatically open a Wikipedia lookup of it.
  • If you’re in the Mail app, then Force Clicking on the address in the email will open the Map that shows the location.
  • If someone has sent you a date and time for an event via Messages or email, then Force Clicking on it will automatically create a Calendar entry.
  • You can also force click on a file in Finder and automatically get a preview of the file without opening the application.
  • You can also force click on a link in Safari to get a quick preview of the webpage.
  • In addition, the force sensors can sense a range of pressures on the trackpad, so you can press lightly for a thin stroke or harder for a thick one, allowing you to create a more accurate illustration while signing your signature for forms in Preview based on the pressure.
  • You can fast forward a video in QuickTime by pressing deeper on the fast forward button. The deeper you press, the faster it goes.
  • In some ways, Apple seems to be replacing the three-finger tap with the Force Click gesture. Update: You can use the two-finger tap on the Force Touch trackpad for the right-click just like the previous trackpad.


    Aside from the Force Touch,  is the Digital Touchhow use digital touch.
    The first way to communicate via Digital Touch is to draw a picture on your Apple Watch screen. Your drawing will animate and disappear after a few seconds of inactivity, which is then sent to your friend. When your friend opens your Digital Touch, your drawing will be drawn on their screen in the same way that you drew it – a small but personal touch.


    http://www2.forbes.com/tech/massive-iphone-6s-leak-reveals-11-new-features/


Monday, June 8, 2015

WWDC15 Day 1



I am there without being there. The pictures are magnificent.  Brandon Moss gets some Apple swag. I am reviewing some of the new information and before you can say WWDC14, there is a Swift2. A second course on swift...iOS Development in Swift for the ITunes.

http://en.wikipedia.org/wiki/El_Capitan

Metal for mac on OSX 10- graphics, layers, richer 3d worlds

Here are some updates on ios9:

  • extending batterry life, performance, security
  • Intelligence Siri, - Proactive, Context sensitive
  • Automatically put things in calendar
  • knows you listen to music while running
  • Suggestions about phone calls without number
  • Search improvements and a API for search - find content within app
  • Back link in search
  • Siri - remind you about this -"on a text message"
  • Pictures - bar at bottom scroll thru pictures
  • Privacy - on device, not shared with 3rd parties
  • Apple Pay - Jennifer Bailey - Trader Joes Dunkin Donuts, JCPenny, working with Square, new apps with apple pay, working with pinterest

http://www.globalnerdy.com/2015/06/08/how-to-catch-todays-wwdc-keynote-livestream-and-liveblogs/

Houston paper "A key feature is the ability to run multiple apps side by side. It’s already possible to run multiple apps, but you see one at a time and have to keep switching. Now you can be browsing in Safari and slide in a second app such as Mail or Calendar from the right side. There’s also a split-screen view similar to what’s coming to the new Mac operating system this fall."

Apple want's its own high speed network http://www.technobuffalo.com/2015/06/08/apple-wants-faster-networks-for-its-services/


Rumors have tagged Apple's streaming service as a $10-per-month, paid-only subscription, although with a lengthy three-month-long free trial. Morris backed that up. http://www.computerworld.com/article/2932319/mac-apps/sony-music-chief-confirms-apple-streaming-service-unveils-on-monday.html


WatchOS 2 http://techcrunch.com/2015/06/10/5-great-things-apple-watch-apps-will-be-able-to-do-in-watchos-2

http://www.iphonehacks.com/2015/06/apple-launch-one-developer-program.html


http://www.iphonehacks.com/2015/06/ios-9-swift-2-wwdc-notes-developer.html

Saturday, June 6, 2015

I took in a cocoa conference last year. It was a few weeks before WWDC 2014. Not a mention of Swift at all at that conference. A year later,  its clear to me that Swift  programming language will change how everyone develops apps for iOS.