Skip to content

Instantly share code, notes, and snippets.

kylehowells / CBManagerAuthorization+String.swift
Created March 9, 2023 01:18
Debug strings for CBManagerAuthorization
View CBManagerAuthorization+String.swift
import Foundation
import CoreBluetooth
extension CBManagerAuthorization : CustomDebugStringConvertible {
public var debugDescription: String {
switch self {
case .allowedAlways: return "allowedAlways"
case .denied: return "denied"
case .notDetermined: return "notDetermined"
kylehowells / WaveView.swift
Created February 25, 2023 23:27
Animates a wave ripple along the top
View WaveView.swift
import UIKit
// MARK: - WaveView
class WaveView: UIView {
private var shapeLayer: CAShapeLayer = CAShapeLayer()
// MARK: - Animation Properties
View SceneKitBoundingBox.swift
import SceneKit
struct SceneKitBoundingBox {
let backLeftTop: SCNVector3
let backLeftBottom: SCNVector3
let backRightTop: SCNVector3
let backRightBottom: SCNVector3
let frontLeftTop: SCNVector3
View Get First Responder.swift
import UIKit
extension UIResponder {
private weak static var _currentFirstResponder: UIResponder? = nil
public static var current: UIResponder? {
UIResponder._currentFirstResponder = nil
UIApplication.shared.sendAction(#selector(findFirstResponder(sender:)), to: nil, from: nil, for: nil)
return UIResponder._currentFirstResponder
View AVMakeRectFill.swift
private func AVMakeRectFill(aspectRatio: CGSize, insideRect boundingRect: CGRect) -> CGRect {
let targetSize = boundingRect.size
if targetSize == .zero {
return .zero
let widthRatio = targetSize.width / aspectRatio.width
let heightRatio = targetSize.height / aspectRatio.height
let scalingFactor = max(widthRatio, heightRatio)
kylehowells / MP4Exporter.swift
Created July 3, 2022 03:56
Export UIView as MP4 in Swift using AVFoundation AVAssetWriter
View MP4Exporter.swift
// MP4Exporter.swift
// Code Examples
// Created by Kyle Howells on 03/07/2022.
import Foundation
import UIKit
import AVFoundation
View UIImage+Resize.swift
import CoreGraphics
import UIKit
import AVFoundation
extension UIImage {
func resized(within newSize: CGSize, outputScale: CGFloat? = nil) -> UIImage {
let originalSize = self.size
let withinBounds = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
kylehowells / FreeSpaceViewController.swift
Created May 4, 2022 23:24
UIViewController subclass to show both the Settings app displayed free space, and the real free space.
View FreeSpaceViewController.swift
// FreeSpaceViewController.swift
// Free Space
// Created by Kyle Howells on 04/05/2022.
import UIKit
class FreeSpaceViewController: UIViewController {
kylehowells / SystemBlurExamplesViewController.swift
Created April 3, 2022 19:50
Examples of the different UIBlurEffect styles available in iOS
View SystemBlurExamplesViewController.swift
import UIKit
import PhotosUI
class SystemBlurExamplesViewController: UIViewController, PHPickerViewControllerDelegate {
// MARK: - Setup View
override func loadView() {
self.view = SystemBlurExamplesView()
View Jellyfin Video

Getting a streamable link is done by the client.

You basically need to send the service a detailed list of the type of media you can play, and it will give you a transcode URL to call if it thinks you need transcoding in order to play this file.

If you don't and can play the file directly it won't give you a transcode URL.

POST <server_address>/Items/<item_id>/PlaybackInfo?UserId=<current_user_id>