Try the search, it's linked to some great forums

Tuesday, September 29, 2015

Swift notes

Tips, tricks & notes about Apple's Swift;

Functions & Closures -  https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html#//apple_ref/doc/uid/TP40014097-CH11-ID94
  • Functions - Use func to declare a function. Call a function by following its name with a list of arguments in parentheses. Use -> to separate the parameter names and types from the function’s return type.
  • Functions can also take a variable number of arguments, collecting them into an array -      func sumOf(numbers: Int...) -> Int {
  • Functions can be nested. Nested functions have access to variables that were declared in the outer function. You can use nested functions to organize the code in a function that is long or complex.
  • Functions are a first-class type. This means that a function can return another function as its value. 
  • Functions are actually a special case of closures: blocks of code that can be called later. The code in a closure has access to things like variables and functions that were available in the scope where the closure was created, even if the closure is in a different scope when it is executed 
  • Closures are self-contained blocks of functionality that can be passed around and used in your code.
  • You can write a closure without a name by surrounding code with braces ({}). Use in to separate the arguments and return type from the body. 
  • Single statement closures implicitly return the value of their only statement -                         let mappedNumbers = numbers.map({ number in 3 * number })
  •  A closure passed as the last argument to a function can appear immediately after the parentheses. When a closure is the only argument to a function, you can omit the parentheses entirely - let sortedNumbers = numbers.sort { $0 > $1 }
Objects and Classes -  https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ClassesAndStructures.html#//apple_ref/doc/uid/TP40014097-CH13-ID82
  • Use class followed by the class’s name to create a class. A property declaration in a class is written the same way as a constant or variable declaration, except that it is in the context of a class. Likewise, method and function declarations are written the same way.
  •  Use an initializer to set up the class when an instance is created. Use init to create one.  
  •  init(name: String)  
    self.name = name
        }
  •  Notice how self is used to distinguish the name property from the name argument to the initializer.
  •  
Other Notes taken at random places:
  • Completion Handlers, used for closures in many functions (see AlertViews) - good post This is the BEST tutorial I found, it hs all the flavors - http://sourcefreeze.com/uialertcontroller-ios-8-using-swift/
  • Alert screens, used for popups & User instruction - good tutorial 
  • You use this representation to create an adaptive interface, which is an interface that automatically adjusts so that it looks good in the context of the current device and orientation.
  • var window: UIWindow? - the question mark means it's optional ( ie it may not exist ie (may be nil))
  • variables are mutable - var myVariable = 42
  • constants are immutable - let myConstant = 42
The AppDelegate class is where you write your custom app-level code. 

Singleton - Swift - ObjectiveC migration
Singletons provide a globally accessible, shared instance of an object. You can create your own singletons as a way to provide a unified access point to a resource or service that’s shared across an app, such as an audio channel to play sound effects or a network manager to make HTTP requests.

Importing Objective-C into Swift - To import a set of Objective-C files in the same app target as your Swift code, you rely on an Objective-C bridging header to expose those files to Swift. Xcode offers to create this header file when you add a Swift file to an existing Objective-C app, or an Objective-C file to an existing Swift app. 

Migration - Migration methodology
Provides an opportunity to revisit an existing Objective-C app and improve its architecture, logic, and performance by replacing pieces of it in Swift. For a straightforward, incremental migration of an app, you’ll be using the tools learned earlier—mix and match plus interoperability. Mix-and-match functionality makes it easy to choose which features and functionality to implement in Swift, and which to leave in Objective-C. Interoperability makes it possible to integrate those features back into Objective-C code with no hassle. Use these tools to explore Swift’s extensive functionality and integrate it back into your existing Objective-C app without having to rewrite the entire app in Swift at once

NSUserDefaults - Migration methodology 

class NSUserDefaults : NSObject
Description   
The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user’s defaults database. The parameters are referred to as defaults since they’re commonly used to determine an application’s default state at startup or the way it acts by default.



Tuesday, September 22, 2015

WhirlyGlobe Tutorial

Here's a screenshot of a tutorial I did for the WhirlyGlobe folks.  BTW it's the coolest map visualization in the world, Duh!

Monday, September 21, 2015

Eating Da Loca(l) Vida

Now that summer's over & things are quieting down, the area's local eateries are serving up some great nightly specials.  This map is a partial list of some of the great nightly dining deals out there!

Cesium, the new Google Earth plugin?

This is an example of a very slick webGL application for building 3d Earth visualizations - Doarama™ is a 3D visualization engine for geolocated activities. The service allows you to upload GPS track logs (from a smartphone or sports GPS tracker) of activities you have participated in. These tracks are then visualized on a 3D map directly within a web browser using familiar controls and intuitive navigation. 
This is built using Cesium.  Cesium is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics, and is cross-platform, cross-browser, and tuned for dynamic-data visualization. Cesium is open source under the Apache 2.0 license. It is free for commercial and non-commercial use.
Here we have a GPX track from sailing on the Saline Solution.

Tuesday, September 15, 2015

Happy Hour map

Here's the start of another dynamic map;

Monday, September 14, 2015

Google Earth Plugin

Brew Cruz Map

Here's the beginning of a themed map (linked to a Google sheet);

Sunday, September 6, 2015

Mapping APIs & linkage

Here are some commonly used web & mobile mapping APIs;
 GPSVisualizer - My old standby.  Free, simple to use & modify (best in class!)

Leaflet - An Open Source JavaScript Library for Mobile Friendly Interactive Maps
Mapbox - An open source mapping platform for custom designed maps. Their APIs and SDKs are the building blocks to integrate location into any mobile or web app
CartoDB Cloud Based Solution for your dynamic data, not free
ArcGIS - The Autocad of GIS programs.  Widely used for the most sophisticated apps out there
Google Earth - The Google Earth plug-in allows you to navigate and explore geographic data on a 3D globe using a web browser
WhirlyGlobe -  Is a native iPhone Android API which displays a dynamic globe for your location data.  Very Cool!

Stamen watercolor theme

Stamen design  provides a number of beautiful mapping 'themes' that you can use.  Check out their website http://maps.stamen.com/#terrain/12/37.7706/-122.3782

Tuesday, September 1, 2015

Historic Maps - Embedding David Rumsey Maps

The David Rumson Map Collection at UC Berkeley is one of the great historical map collections available on the web.  They have a very cool tool for embedding these maps into current mapping systems.  Check it out below;