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
struct PersonData { | |
let name: String | |
let phoneNumber: Int | |
} |
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
// | |
// Promise + CancelRequest.swift | |
// PeopleFinders | |
// | |
// Created by Efraim Budusan on 12/13/17. | |
// Copyright © 2017 Tapptitude. All rights reserved. | |
// | |
import Foundation | |
import PromiseKit |
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 extension UIView { | |
private struct ExtendedTouchAssociatedKey { | |
static var outsideOfBounds = "viewExtensionAllowTouchesOutsideOfBounds" | |
} | |
/// This propery is set on the parent of the view that first clips the content you want to be touchable | |
/// outside of the bounds | |
var allowTouchesOfViewsOutsideBounds:Bool { | |
get { |
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 extension UIView { | |
private struct ExtendedTouchAssociatedKey { | |
static var outsideOfBounds = "viewExtensionAllowTouchesOutsideOfBounds" | |
} | |
var allowTouchesOutsideOfBounds:Bool { | |
get { | |
return objc_getAssociatedObject(self, &ExtendedTouchAssociatedKey.outsideOfBounds) as? Bool ?? false |
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 PromiseCancelledError: CancellableError { | |
var isCancelled: Bool { | |
return true | |
} | |
} | |
public class CancelablePromise<T> { | |
var promise:Promise<T> | |
var cancellable:TTCancellable! |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
label.attributedText = label.attributedText?.replacing(placeholder: "<first>", with: "Don't") | |
.replacing(placeholder: "<last>", with: "anymore.") | |
} |
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
extension NSAttributedString { | |
func replacing(placeholder:String, with valueString:String) -> NSAttributedString { | |
if let range = self.string.range(of:placeholder) { | |
let nsRange = NSRange(range,in:valueString) | |
let mutableText = NSMutableAttributedString(attributedString: self) | |
mutableText.replaceCharacters(in: nsRange, with: valueString) | |
return mutableText as NSAttributedString | |
} |