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 Foundation | |
import CoreBluetooth | |
import CoreLocation | |
class Beacon: NSObject { | |
static let shared = Beacon() | |
var localBeacon: CLBeaconRegion! | |
var beaconPeripheralData: [String: 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
import UIKit | |
class CustomSlider: UISlider { | |
private var toolTip: ToolTipPopupView? | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
self.initToolTip() |
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
// | |
// MovieTransitionsVC.swift | |
// VideoAnimations | |
// | |
// Created by Tula on 2018-06-14. | |
// Copyright © 2018 Tula. All rights reserved. | |
// | |
import UIKit | |
import AVFoundation |
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
@IBAction func btnExit0Tapped (sender: UIButton) { | |
exit(0) // Not recommended by Apple https://developer.apple.com/library/content/qa/qa1561/_index.html and app crashes | |
} | |
@IBAction func btnSuspendTapped (sender: UIButton) { | |
UIControl().sendAction(#selector(URLSessionTask.suspend), to: UIApplication.shared, for: nil) // App exits gracefully | |
} | |
@IBAction func btnFatalErrorTapped (sender: UIButton) { | |
fatalError() // App will crash |
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 stringByReplacing(charSet: CharacterSet, with string: String) -> String { | |
let components = self.components(separatedBy: charSet) | |
return components.joined(separator: string) | |
} |
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 UIView { | |
func frameOfFirstResponder() -> CGRect? { | |
if self.isFirstResponder { | |
return self.frame | |
} | |
for view in self.subviews { | |
if let frame = view.frameOfFirstResponder() { | |
return frame | |
} |
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
enum FontName: String { | |
case timesNewRoman = "TimesNewRomanPSMT" | |
case timesNewRomanItalic = "TimesNewRomanPS-ItalicMT" | |
case timesNewRomanBold = "TimesNewRomanPS-BoldMT" | |
} | |
extension UIFont { | |
class var sanFranciscoRegular: UIFont { | |
if let font = UIFont.init(name: "SFUIText-Regular", size: 15) { |
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
+ (NSString *) encodeString: (NSString *) string { | |
NSMutableString *output = [NSMutableString string]; | |
const unsigned char *source = (const unsigned char *)[string UTF8String]; | |
int sourceLen = (int)strlen((const char *)source); | |
for (int i = 0; i < sourceLen; ++i) { | |
const unsigned char thisChar = source[i]; | |
if (thisChar == ' '){ | |
[output appendString:@"%20"]; | |
} else if (thisChar == '.' || thisChar == '-' || thisChar == '_' || thisChar == '~' || |
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 | |
@objc class MyAPI: NSObject { | |
static let keyError: String = "Error" | |
static let keyResult: String = "Result" | |
static let unknownError: String = "Unknown error" | |
static let notificationMyAPIDidEnd = Notification.Name(rawValue: "notificationMyAPIDidEnd") |