Skip to content

Instantly share code, notes, and snippets.

View freak4pc's full-sized avatar
🤓

Shai Mishali freak4pc

🤓
View GitHub Profile
@DavidBrunow
DavidBrunow / XCTest+AssertStandardSnapshots.swift
Last active December 2, 2023 21:28
Helper Code for Snapshot Testing
import AccessibilitySnapshot
import SnapshotTesting
import SwiftUI
import XCTest
extension Snapshotting where Value == UIViewController, Format == UIImage {
fileprivate static func standardImage(
on viewImageConfig: ViewImageConfig,
perceptualPrecision: Float = 0.98,
precision: Float = 0.995
@dkun7944
dkun7944 / ContentView.swift
Created July 31, 2023 03:36
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
@noahsark769
noahsark769 / LoginViewController.swift
Created December 29, 2020 20:03
Copying WKWebView cookies into HTTPCookieStorage
extension LoginViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
if let url = webView.url, url.absoluteString.contains("/index.action") {
let store = WKWebsiteDataStore.default().httpCookieStore
store.getAllCookies { cookies in
if let sessionIdCookie = cookies.first(where: { cookie in
cookie.name == "JSESSIONID"
}) {
HTTPCookieStorage.shared.setCookies(cookies, for: webView.url, mainDocumentURL: nil)
self.callback(ConfluenceSessionCookie(jSessonId: sessionIdCookie))
extension UIHostingController {
convenience public init(rootView: Content, ignoreSafeArea: Bool) {
self.init(rootView: rootView)
if ignoreSafeArea {
disableSafeArea()
}
}
func disableSafeArea() {
@IanKeen
IanKeen / Usage.swift
Created July 24, 2020 18:47
SwiftUI: Show a sheet based on an optionals unwrapped value
@main
struct MyApp: App {
enum Sheet { case first, second }
@State var sheet: Sheet? = nil
var body: some Scene {
WindowGroup {
VStack {
Button("First") { sheet = .first }
@dduan
dduan / SpeakBubble.swift
Last active June 20, 2020 13:56
Twitter's voice tweet UI has an interesting animation on iOS. This is an attempt to recreate that animation with SwiftUI. Looks like this https://youtu.be/I6XZzIgWYAQ
import SwiftUI
struct ChaoticPhoto: View {
let image: Image
let radius: CGFloat
@Binding var activated: Bool
@State var scale: CGFloat = 1
var body: some View {
image
.resizable()
Hello,
I'd like to request the following information, in accordance with the information rights in the GDPR, and particularly Article 15. Please address all points in this email in turn.
1. A copy of all my personal data held and/or undergoing processing, in a commonly used electronic form (Article 15(3)). Please note that this might also include any audiovisual material (e.g. voice-recordings or pictures) and is not necessarily limited to the information contained in your customer database and/or the information you make available through the ‘manage my profile’ functionality. For all data that would fall under Article 20 (portability), I would like to recieve this in a commonly-used machine readable format. For data that does not fall under Article 20, such as data inferred about me or opinions about me, I would like this in a commonly-used electronic format.
2. If any data was not collected, observed or inferred from me directly, precise information about the source of that data, including the name and c
@warpling
warpling / CAMediaTimingFunction.swift
Last active June 14, 2022 11:15
Better CAMediaTimingFunctions
//
// CAMediaTimingFunction.swift
import UIKit
extension CAMediaTimingFunction {
static let linear = CAMediaTimingFunction(name: .linear)
static let easeOut = CAMediaTimingFunction(name: .easeOut)
// 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
@leoMehlig
leoMehlig / Keyframes.swift
Created October 17, 2019 16:00
Keyframe animations in SwiftUI
//
// Keyframes.swift
// Watch Extension
//
// Created by Leo Mehlig on 17.10.19.
// Copyright © 2019 Asana Rebel GmbH. All rights reserved.
//
import SwiftUI