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
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { | |
if(self.tableView.respondsToSelector(Selector("setSeparatorInset:"))){ | |
self.tableView.separatorInset = UIEdgeInsetsZero | |
} | |
if(self.tableView.respondsToSelector(Selector("setLayoutMargins:"))){ | |
self.tableView.layoutMargins = UIEdgeInsetsZero | |
} | |
if(cell.respondsToSelector(Selector("setLayoutMargins:"))){ |
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
// | |
// ViewController.swift | |
// AttributedString | |
// | |
// Created by Peter Goldsmith on 27/02/2017. | |
// | |
import UIKit | |
class ViewController: UIViewController { |
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
static BOOL PSPDFIsDevelopmentBuild(void) { | |
#if TARGET_IPHONE_SIMULATOR | |
return YES; | |
#else | |
static BOOL isDevelopment = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// There is no provisioning profile in AppStore Apps. | |
NSData *data = [NSData dataWithContentsOfFile:[NSBundle.mainBundle pathForResource:@"embedded" ofType:@"mobileprovision"]]; | |
if (data) { |
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
/** | |
* Perform a throwing expression, and throw a custom error in case the expression threw | |
* | |
* - parameter expression: The expression to execute | |
* - parameter error: The custom error to throw instead of the expression's error | |
* - throws: The given error | |
* - returns: The return value of the given expression | |
*/ | |
func perform<T>(_ expression: @autoclosure () throws -> T, orThrow errorExpression: @autoclosure () -> Error) throws -> T { | |
do { |
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
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) -> Void) -> T { | |
builder(value) | |
return value | |
} | |
@discardableResult | |
public func with<T>(_ value: T, _ builder: (T) throws -> Void ) rethrows -> T { | |
try builder(value) | |
return value |
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
//: | |
//: UserDefaultable.swift | |
//: | |
//: Created by Andyy Hope on 18/08/2016. | |
//: Twitter: @andyyhope | |
//: Medium: Andyy Hope, https://medium.com/@AndyyHope | |
import Foundation | |
// MARK: - Key Namespaceable |
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
// | |
// ViewController.swift | |
// UIViewCapture | |
// | |
// Created by Yusuke on 11/7/16. | |
// Copyright © 2016 Yusuke. All rights reserved. | |
// | |
import UIKit |
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
#include <ifaddrs.h> | |
// http://stackoverflow.com/questions/25626117/how-to-get-ip-address-in-swift | |
func getIFAddresses() -> [String] { | |
var addresses = [String]() | |
// Get list of all interfaces on the local machine: | |
var ifaddr : UnsafeMutablePointer<ifaddrs> = nil | |
if getifaddrs(&ifaddr) == 0 { | |
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 SwiftUI | |
public struct Platform: OptionSet { | |
public var rawValue: UInt8 | |
public static let iOS = Platform(rawValue: 1 << 0) | |
public static let macOS = Platform(rawValue: 1 << 1) | |
public static let tvOS = Platform(rawValue: 1 << 2) | |
public static let watchOS = Platform(rawValue: 1 << 3) | |
public static let all: Platform = [.iOS, .macOS, .tvOS, .watchOS] |
OlderNewer