I hereby claim:
- I am hashaam on github.
- I am hashaam (https://keybase.io/hashaam) on keybase.
- I have a public key whose fingerprint is 9B13 E340 5453 901A CB45 8408 2B0C BF4B F563 75A7
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // https://hashaam.com/2017/06/15/configure-audio-session-for-background-audio-mode-ios-project/ | |
| import UIKit | |
| import AVFoundation | |
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? |
| // https://hashaam.com/2017/06/15/display-now-playing-information-in-command-center/ | |
| import UIKit | |
| import MediaPlayer | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| // https://hashaam.com/2017/07/19/handle-remote-control-commands/ | |
| import UIKit | |
| import MediaPlayer | |
| class ViewController: UIViewController { | |
| var player: AVPlayer? | |
| func setupRemoteCommandCenter(enable: Bool) { |
| // https://hashaam.com/2017/07/20/custom-sorting-an-array-in-swift/ | |
| struct Business { | |
| let businessId: Int | |
| let rating: Int | |
| } | |
| func sortBusinesses(_ businesses: [Business]) -> [Business] { | |
| let set = NSOrderedSet(array: businesses) |
| // https://hashaam.com/2017/07/22/get-device-token-for-remote-push-notifications-in-swift-3/ | |
| func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
| let tokenParts = deviceToken.map { data -> String in | |
| return String(format: "%02.2hhx", data) | |
| } | |
| let token = tokenParts.joined() | |
| // https://hashaam.com/2017/08/31/uiwindow-presentation-context/ | |
| extension UIWindow { | |
| func presentationContext(context: UIViewController? = nil) -> UIViewController? { | |
| var presentationContextViewController = rootViewController | |
| if let context = context { | |
| presentationContextViewController = context | |
| } |
| // https://hashaam.com/2017/08/31/uiwindow-presentation-context/ | |
| if let delegate = UIApplication.shared.delegate, let window = delegate.window, let viewController = window?.presentationContext() { | |
| // perform action on viewController | |
| } |
| // https://hashaam.com/2017/09/02/get-filename-without-extension | |
| let path = "hls_a128_v4.m3u8" | |
| let url = URL(string: path) | |
| let filename = url?.deletingPathExtension().lastPathComponent | |
| print(filename) // hls_a128_v4 | |
| let fileExtension = url?.pathExtension |