Skip to content

Instantly share code, notes, and snippets.

View StarLard's full-sized avatar

Caleb Friden StarLard

View GitHub Profile
@StarLard
StarLard / DetentSheet.swift
Last active January 7, 2023 07:22
A simple implementation of an UISheetPresentationController wrapper using SwiftUI
//
// DetentSheet.swift
// StarLardKit
//
// Created by Caleb Friden on 9/28/21.
//
import SwiftUI
// MARK: - Public
@StarLard
StarLard / SFSafariViewControllerLoginDemo.swift
Created June 11, 2021 02:50
Brief demo showcasing login with SFSafariViewController
import SafariServices
func logInWithBlizzard() {
//Blizzard OAuth URL
if let authURL = URL(string: "https://myRegioncode.battle.net/oauth/authorize?access_type=online&client_id=myClientID&redirect_uri=myRedirectURI&response_type=code&state=") {
let safariVC = SFSafariViewController(url: authURL, entersReaderIfAvailable: true)
safariVC.delegate = self
self.present(safariVC, animated: true)
}
@StarLard
StarLard / SFAuthenticationSessionDemo.swift
Created June 11, 2021 02:49
Brief demo showcasing SFAuthenticationSession
import SafariServices
var authSession: SFAuthenticationSession?
func logInWithBlizzard() {
//Blizzard OAuth URL
let authURL = URL(string: "https://myRegioncode.battle.net/oauth/authorize?access_type=online&client_id=myClientID&redirect_uri=myRedirectURI&response_type=code&state=")
let loginUrlScheme = "myAppName"
//Initialize auth session
@StarLard
StarLard / ASWebAuthenticationSessionDemo.swift
Created June 11, 2021 02:43
Brief demo showcasing ASWebAuthenticationSession
import AuthenticationServices
var webAuthSession: ASWebAuthenticationSession?
@available(iOS 12.0, *)
func logInWithBlizzard() {
//Blizzard OAuth URL
let authURL = URL(string: "https://myRegioncode.battle.net/oauth/authorize?access_type=online&client_id=myClientID&redirect_uri=myRedirectURI&response_type=code&state=")
let loginUrlScheme = "myAppName"
@StarLard
StarLard / FetchImageView.swift
Last active December 30, 2020 01:12
FetchImageView
import SwiftUI
import Nuke
@available(watchOS 7.0, *)
@available(tvOS 14.0, *)
@available(iOS 14.0, *)
@available(OSX 11.0, *)
public struct FetchImageView<Placeholder>: View where Placeholder: View {
public var body: some View {
content