Skip to content

Instantly share code, notes, and snippets.

@arpit
Created November 28, 2014 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arpit/02ad008a35673fbf6b33 to your computer and use it in GitHub Desktop.
Save arpit/02ad008a35673fbf6b33 to your computer and use it in GitHub Desktop.
Find pattern to read all public vars in a swift model and replace in your json parser
//Find:
var\s([A-Za-z_]+):\s?[A-Za-z!_\\?]+
//Replace:
if(g[i]["$1"] != nil && g[i]["$1"] as? NSNull == nil){
goal.$1 = g[i]["$1"] as AnyObject? as String!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment