Skip to content

Instantly share code, notes, and snippets.

View kaishin's full-sized avatar

Reda Lemeden kaishin

View GitHub Profile
@sschizas
sschizas / DoHConfigurarion.swift
Created December 23, 2020 20:03
DNS-over-HTTPS (DoH) configuration enumeration to be used in `NWParameters.PrivacyContext`.
enum DoHConfigurarion: Hashable {
case adGuard
case alibaba
case cloudflare
case google
case openDNS
case quad9
var httpsURL: URL {
switch self {
@ubuwaits
ubuwaits / class-notes.md
Last active December 21, 2020 09:56
Hyper Island Lecture: Modern Web Type
// Original article here: https://www.fivestars.blog/swiftui/app-scene-storage.html
import Combine
import SwiftUI
// MARK: Appearance
enum Appearance: String, Codable, CaseIterable, Identifiable {
case dark
case light
@magnuskahr
magnuskahr / EnumPicker.swift
Last active February 27, 2023 21:22
A simple picker to pick a enum.
import SwiftUI
struct EnumPicker<T: Hashable & CaseIterable, V: View>: View {
@Binding var selected: T
var title: String? = nil
let mapping: (T) -> V
var body: some View {
@DreamingInBinary
DreamingInBinary / Best in Class iOS Checklist
Last active January 29, 2024 18:18
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support

Extending Vapor Application and Request to support AWS SDK Swift

import AWSS3
import Vapor

public extension Application {
    var aws: AWS {
        .init(application: self)
    }
@mecid
mecid / AnimatableVector.swift
Last active December 27, 2023 21:43
High-performance Animatable Vector for SwiftUI
import SwiftUI
import enum Accelerate.vDSP
struct AnimatableVector: VectorArithmetic {
static var zero = AnimatableVector(values: [0.0])
static func + (lhs: AnimatableVector, rhs: AnimatableVector) -> AnimatableVector {
let count = min(lhs.values.count, rhs.values.count)
return AnimatableVector(values: vDSP.add(lhs.values[0..<count], rhs.values[0..<count]))
}
@chriseidhof
chriseidhof / boilerplate.swift
Last active January 3, 2024 05:54
QuickMacApp
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@ethanhuang13
ethanhuang13 / FacebookAuth.swift
Last active March 28, 2024 08:24
FacebookAuth is for iOS app developers who need to support Facebook login but don't want to use the official SDK
//
// FacebookAuth.swift
// GitHub: ethanhuang13
// Twitter: @ethanhuang13
import AuthenticationServices
import SafariServices
/*
Updated:
@sharplet
sharplet / Always.swift
Last active February 15, 2024 18:50
A Combine publisher that repeatedly emits the same value as long as there is demand
// Copyright (c) 2019–20 Adam Sharp and thoughtbot, inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in