My goal was to make something somewhat inspired by the Yahoo News Digest app, then I realized that not having pictures could be an issue with the personality of the articles, a simple list of text will look to serious and not fun to read. My approach was to give some life to the list by using different colors based on the index of the article.
This file contains 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
[ | |
{ | |
"id": "5f9e815c8e25c6bf8560cafb", | |
"start_date": "2020-12-15T11:00:00 -01:00", | |
"end_date": "2020-12-15T12:00:00 -01:00", | |
"name": "TOYLETRY", | |
"friends": [ | |
{ | |
"id": 0, | |
"name": "Patrick Smith", |
This file contains 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
[ | |
{ | |
"_id": "5a4f4635c8e945ce7d435ae2", | |
"index": 0, | |
"guid": "c39233a4-b90f-4cf4-a759-eb378b7671e6", | |
"isActive": false, | |
"balance": "$2,632.67", | |
"picture": "http://placehold.it/32x32", | |
"age": 30, | |
"eyeColor": "blue", |
This file has been truncated, but you can view the full file.
This file contains 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
{ | |
"size": 5957, | |
"items": [ | |
{ | |
"image": { | |
"scalable": true, | |
"width": 1600, | |
"type": "GENERAL", | |
"url": "2017/9/vertical-5/30/5/105/424/_1263219766.jpg", | |
"height": 1083 |
This file contains 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
import UIKit | |
import PlaygroundSupport | |
class CustomLabel: UILabel { | |
var topInset: CGFloat = 2.25 | |
var bottomInset: CGFloat = 2.25 | |
override func drawText(in rect: CGRect) { | |
let insets = UIEdgeInsets(top: topInset, left: 0, bottom: bottomInset, right: 0) | |
super.drawText(in: UIEdgeInsetsInsetRect(rect, insets)) |
This file contains 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
// When you are in the diff page of a GitHub PR | |
// And want to hide all the Pods/* files in that diff page, use this: | |
// Paste that in your Web Inspector's console | |
var nodes = document.evaluate("//div[@class='file-header' and starts-with(@data-path,'Carthage/')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); | |
for(i=0; i<nodes.snapshotLength; ++i) { | |
nodes.snapshotItem(i).parentNode.hidden = true | |
} | |
// Or even better, create a bookmark with this code for easy quick access: |
This file contains 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
{ | |
"feed": { | |
"author": { | |
"name": { | |
"label": "iTunes Store" | |
}, | |
"uri": { | |
"label": "http://www.apple.com/itunes/" | |
} | |
}, |
This file contains 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
import UIKit | |
import XCPlayground | |
let containerWidth = CGFloat(320) | |
let containerHeight = CGFloat(568) | |
//*************************** | |
//*************************** | |
//****** Basic set up ******* | |
//*************************** |
This file contains 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
public func drop() throws { | |
guard let store = self.persistentStoreCoordinator.persistentStores.last, storeURL = store.URL, storePath = storeURL.path | |
else { throw NSError(info: "Persistent store coordinator not found", previousError: nil) } | |
let sqliteFile = (storePath as NSString).stringByDeletingPathExtension | |
let fileManager = NSFileManager.defaultManager() | |
self._writerContext = nil | |
self._mainContext = nil | |
self._persistentStoreCoordinator = nil |
This file contains 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
class func dataStackWithModelName(modelName: String) -> DATAStack { | |
let bundle = NSBundle(forClass: Helper.self) | |
let dataStack = DATAStack(modelName: modelName, bundle: bundle, storeType: .SQLite) | |
return dataStack | |
} |
NewerOlder