View UISegmentedControl+Vertical.swift
//
// UISegmentedControl+Vertical.swift
// Make a UISegmentedControl vertical by setting mySegmentedControl.vertical = true
//
// Created by Yonat Sharon on 14/9/14.
// Copyright (c) 2014 Yonat Sharon. All rights reserved.
//
import UIKit
View String+substr.swift
extension String {
/**
Perl style substring
- parameter offset: Negative offset starts that far back from the end of the string
- parameter length: Negative length leaves that many characters off the end of the string. Omit to return everything through the end of the string.
*/
func substr(offset: Int, length: Int = 0) -> String {
let start = offset < 0 ? endIndex.advancedBy(offset, limit: startIndex) : startIndex.advancedBy(offset, limit: endIndex)
let end = length > 0 ? start.advancedBy(length, limit: endIndex) : endIndex.advancedBy(length, limit: startIndex)
View DoesSomethingInBackground.swift
class DoesSomethingInBackground
{
var backgroundTaskID: UIBackgroundTaskIdentifier = UIBackgroundTaskInvalid
func beginBackgroundTask() {
guard UIBackgroundTaskInvalid == backgroundTaskID else {return}
backgroundTaskID = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler { () -> Void in
self.endBackgroundTask()
}
}
View FBSDKGraphRequest+Paging.h
//
// FBSDKGraphRequest+Paging.h
// Facebook Paging Extension
//
// Created by Yonat Sharon on 04.04.2016.
// Copyright © 2016 Yonat Sharon. All rights reserved.
//
#import <FBSDKCoreKit/FBSDKCoreKit.h>
View ask.swift
/// Show an OK/Cancel modal box that works in both iOS 7 and iOS 8
func ask(title: String, #message: String, #completion: (answer: Bool) -> Void) {
if nil != objc_getClass("UIAlertController".UTF8String) { // use UIAlertController
let alertController = UIAlertController(title: title, message: message, preferredStyle: .Alert)
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: { (action) -> Void in
completion(answer: false)
})
let okayAction = UIAlertAction(title: "OK", style: .Default, handler: { (action) -> Void in
completion(answer: true)
})
View Save-iOS-image-name.md
View MKStoreKitConfigs.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Consumables</key>
<dict>
<key>com.steinlogic.dummyconsumable.pack10</key>
<dict>
<key>ConsumableCount</key>
<integer>10</integer>
View Badge.swift
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.