Skip to content

Instantly share code, notes, and snippets.

View rafaelreis-hotmart's full-sized avatar

Rafael Reis rafaelreis-hotmart

View GitHub Profile
// A URLSession extension that fetches data from a URL and decodes to some Decodable type.
// Usage: let user = try await URLSession.shared.decode(UserData.self, from: someURL)
// Note: this requires Swift 5.5.
extension URLSession {
func decode<T: Decodable>(
_ type: T.Type = T.self,
from url: URL,
keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = .useDefaultKeys,
dataDecodingStrategy: JSONDecoder.DataDecodingStrategy = .deferredToData,
dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .deferredToDate
@neha-bansal790
neha-bansal790 / DRMFairplay.swift
Last active March 24, 2022 07:00
DRM fairplay with hls integration
//
// DRMFairplay.swift
// Collection
//
// Created by B0203948 on 04/02/20.
// Copyright © 2020 wynk. All rights reserved.
//
import UIKit
import AVFoundation
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit