Skip to content

Instantly share code, notes, and snippets.

View rlabr's full-sized avatar

Raghav's LABoratoRy rlabr

View GitHub Profile
@douglashill
douglashill / FourColumns.swift
Created June 23, 2020 21:05
A sample UIKit app that sets up a four column layout with new iOS 14 API on UISplitViewController.
import UIKit
class FourColumnsContainerViewController: UIViewController {
let outerSplitViewController = UISplitViewController(style: .tripleColumn)
let innerSplitViewController = UISplitViewController(style: .doubleColumn)
let primary = makeContentViewController("App")
let secondary = makeContentViewController("Files")
let mainContent = makeContentViewController("File Content")
let inspector = makeContentViewController("Inspector")
@fousa
fousa / FairPlayer.swift
Last active June 1, 2023 12:28
Integrate HLS with FairPlay.
class FairPlayer: AVPlayer {
private let queue = DispatchQueue(label: "com.icapps.fairplay.queue")
func play(asset: AVURLAsset) {
// Set the resource loader delegate to this class. The `resourceLoader`'s delegate will be
// triggered when FairPlay handling is required.
asset.resourceLoader.setDelegate(self, queue: queue)
// Load the asset in the player.
@alexkent
alexkent / UIViewController+StoryboardConvenience.swift
Created December 21, 2015 15:15
instantiate your UIViewController subclass from a storyboard with slightly prettier casting.
import Foundation
extension UIViewController {
class func fromStoryboard(name: String, identifier: String? = .None, bundle: NSBundle? = .None) -> Self? {
return fromStoryboardHelper(self, name: name, identifier: identifier, bundle: bundle)
}
private class func fromStoryboardHelper<T: UIViewController>(type: T.Type, name: String, identifier: String?, bundle: NSBundle?) -> T? {
if let identifier = identifier {