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
// WastingTimeOnStackOverflowTests.swift Created by mason on 2016-09-18. | |
import XCTest | |
/// Measures performance of two different ways of checking whether an index is valid | |
/// for a given array (the variable "a" is an array of 1,000,000 unique strings, and | |
/// "val" is the index to be checked): | |
/// | |
/// a.indices.contains(val) | |
/// vs: |
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
// | |
// EncryptionHelper.swift | |
// Demo3 | |
// | |
// | |
import Foundation | |
import CommonCrypto | |
struct AES { |
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 PaddingLabel: UILabel { | |
@IBInspectable var topInset: CGFloat = 5.0 | |
@IBInspectable var bottomInset: CGFloat = 5.0 | |
@IBInspectable var leftInset: CGFloat = 7.0 | |
@IBInspectable var rightInset: CGFloat = 7.0 | |
override func drawText(in rect: CGRect) { | |
let insets = UIEdgeInsets(top: topInset, left: leftInset, bottom: bottomInset, right: rightInset) | |
super.drawText(in: rect.inset(by: 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
class PaddingTextField: UITextField { | |
let padding = UIEdgeInsets(top: 4, left: 8, bottom: 4, right: 8) | |
override open func textRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) | |
} | |
override open func placeholderRect(forBounds bounds: CGRect) -> CGRect { | |
return bounds.inset(by: padding) |
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
let imageCache = NSCache<NSString, UIImage>() | |
extension UIImageView { | |
func loadImageUsingCache(withUrl urlString : String) { | |
let url = URL(string: urlString) | |
if url == nil {return} | |
self.image = nil | |
if let cachedImage = imageCache.object(forKey: urlString as NSString) { | |
self.image = cachedImage | |
return | |
} |
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
//Step 1: | |
//Create button clouser | |
var tapsOnButtonClouser:() -> () = {} | |
var isTempBool = false | |
//Step 2: Setup that function | |
func setUpClouser() { | |
tapsOnButtonClouser = { [weak self] in | |
guard let localSelf = self else {return} | |
localSelf.isTempBool = !localSelf.isTempBool | |
print("Temp Bool changed to--> ",localSelf.isTempBool) |
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 | |
extension Formatter { | |
static let enUSPOSIX: DateFormatter = { | |
let formatter = DateFormatter() |
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
// | |
// Obfuscator.swift | |
// | |
// Created by Dejan Atanasov on 2017-05-31. | |
// | |
import Foundation | |
class Obfuscator: AnyObject { | |
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
// MARK: - WelcomeElement | |
struct WelcomeElement: Codable { | |
let userID, id: Int | |
let title: String | |
let completed: Bool | |
enum CodingKeys: String, CodingKey { | |
case userID = "userId" | |
case id, title, completed | |
} |
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
<?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>DeviceDictionary</key> | |
<dict> | |
<key>phone</key> | |
<string>iPhone 6s</string> | |
</dict> | |
<key>ToolString</key> |