Skip to content

Instantly share code, notes, and snippets.

class Document {
var count: Int?
let item: Int
let pag: Paragraph
init(media: Media, pag: Paragraph) {
self.item = 1
self.pag = pag
File().open()
protocol NotificationKey: RawRepresentable, CustomStringConvertible {}
protocol NotificationCenterAbility {
associatedtype T: NotificationKey
static var center: NSNotificationCenter { get }
static func post(key: T, object: AnyObject?, userInfo: [NSObject : AnyObject]?)
}
extension NotificationCenterAbility {
static var center: NSNotificationCenter {
for tasteRawValue in tasteList.keys {
let taste = TasteButton(rawValue: tasteRawValue)!
if let tasteString = taste.toString
where self[taste] == true {
allergiesList.append(tasteString)
}
}
struct ViewModel {
subscript(tasteButton: TasteButton) -> Bool {
get {
guard let status = tasteList[tasteButton.rawValue] else {
return false
}
return status
}
struct Constants {}
private extension Constants {
struct UserDefault {
static let AllergiesList = "..."
}
}
import UIKit
/**
How to use it
````
AlertView
.alert("Are you sure?", message: "Send this message to your friend")
.will("OK") {
// Do something because User choose OK
}
extension UITableView {
/**
Use it as a trick to remove the separator lines of blank cells at the bottom of tableView.
*/
func removeBottomSeparatorLine() {
tableFooterView = UIView(frame: CGRect.zero)
}
func scrollToLastRowOfSection(section: Int, atScrollPosition: UITableViewScrollPosition = .Top, animated: Bool = false) {
{
"expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog,versionedRepresentations",
"id": "10002",
"self": "http://www.example.com/jira/rest/api/2/issue/10002",
"key": "EX-1",
"fields": {
"watcher": {
"self": "http://www.example.com/jira/rest/api/2/issue/EX-1/watchers",
"isWatching": false,
"watchCount": 1,
import UIKit
import FLAnimatedImage
extension FLAnimatedImage {
/**
Provide only the name of gif file.
IMPORTANT: The file MUST have extension as "gif".
*/
convenience init(withGIFName fileName: String) {
import UIKit
import FLAnimatedImage
extension FLAnimatedImage {
/**
Init with the GIF file in your mainBundle.
*/
convenience init?(withGIFName fileName: String) {
guard