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
| 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
| @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
| // | |
| // 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
| 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
| 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
| 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
| 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
| public class WDMainActivity extends AppCompatActivity implements WifiP2pManager.ConnectionInfoListener { | |
| private static final String TAG = "WDMainActivity"; | |
| private static final String KEY_BUDDY_NAME = "buddyname"; | |
| private final IntentFilter intentFilter = new IntentFilter(); | |
| private WifiP2pManager.Channel mChannel; | |
| private WifiP2pManager mManager; |