Skip to content

Instantly share code, notes, and snippets.

@innocuo
Created March 29, 2017 02:11
Show Gist options
  • Save innocuo/6668aa32eb7682276c830660713d0784 to your computer and use it in GitHub Desktop.
Save innocuo/6668aa32eb7682276c830660713d0784 to your computer and use it in GitHub Desktop.
Example of using Struct and extension
struct StructExample{
let text: String
let author: String
static let all: [Quote] = [
StructExample(text:"Enjoy the little things", author:"me"),
StructExample(text:"The best is yet to come", author:"you"),
StructExample(text:"No excuses", author:"she"),
StructExample(text:"The master has failed more times than the beginner has even tried", author:"he"),
StructExample(text:"One day can change everything", author:"not me"),
StructExample(text:"Life is too short to wait", author:"anonymous"),
StructExample(text:"Stop saying \"I wish\", start saying \"I will\"", author:"everyone")
]
}
extension StructExample: CustomStringConvertible{
var description: String{
return "\"\(text)\" - \(author)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment