Skip to content

Instantly share code, notes, and snippets.

@an-indya
Last active May 13, 2018 03:37
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 an-indya/3526d35ede995184ce0a9d84331d31b1 to your computer and use it in GitHub Desktop.
Save an-indya/3526d35ede995184ce0a9d84331d31b1 to your computer and use it in GitHub Desktop.
let books = ["The Great Gatsby by F. Scott Fitzgerald",
"The Prince by Niccolo Machiavelli",
"Slaughterhouse-Five by Kurt Vonnegut",
"1984 by George Orwell",
"The Republic by Plato",
"Brothers Karamazov by Fyodor Dostoevsky",
"The Catcher in the Rye by J.D. Salinger",
"The Wealth of Nations by Adam Smith",
"For Whom the Bell Tolls by Ernest Hemingway",
"The Grapes of Wrath by John Steinbeck",
"Brave New World by Aldous Huxley",
"How To Win Friends And Influence People by Dale Carnegie",
"The Rise of Theodore Roosevelt by Edmund Morris",
"Dharma Bums by Jack Kerouac",
"Catch-22 by Joseph Heller",
"Walden by Henry David Thoreau",
"Lord of the Flies by William Golding",
"The Master and Margarita by by Mikhail Bulgakov",
"Bluebeard by Kurt Vonnegut",
"Atlas Shrugged by Ayn Rand",
"The Metamorphosis by Franz Kafka",
"Another Roadside Attraction by Tom Robbins",
"White Noise by Don Delillo",
"Ulysses by James Joyce",
"The Young Man’s Guide by William Alcott",
"Blood Meridian, or the Evening Redness in the West by Cormac McCarthy",
"Seek: Reports from the Edges of America & Beyond by Denis Johnson",
"Crime And Punishment by Fyodor Dostoevsky",
"Steppenwolf by Herman Hesse",
"East of Eden by John Steinbeck",
"Essential Manners for Men by Peter Post",]
var bookObjects = [AnyObject]()
func populateBookModel () {
books.map {
(book: String) -> String in bookObjects.append(Books(bookName: book.componentsSeparatedByString(" by ")[0], author: book.componentsSeparatedByString(" by ")[1]))
return book
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment