Created
March 29, 2017 02:11
-
-
Save innocuo/6668aa32eb7682276c830660713d0784 to your computer and use it in GitHub Desktop.
Example of using Struct and extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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