This file contains hidden or 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 func update(modifiedDate: Date, url: URL) { | |
do { | |
var values = try url.resourceValues(forKeys: [URLResourceKey.contentModificationDateKey]) | |
values.contentModificationDate = modifiedDate | |
try url.setResourceValues(values) | |
} catch { | |
print(error.localizedDescription) | |
} | |
} |
This file contains hidden or 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 Data { | |
private static let mimeTypeSignatures: [UInt8 : String] = [ | |
0xFF : "image/jpeg", | |
0x89 : "image/png", | |
0x47 : "image/gif", | |
0x49 : "image/tiff", | |
0x4D : "image/tiff", | |
0x25 : "application/pdf", | |
0xD0 : "application/vnd", | |
0x46 : "text/plain", |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) { |