Skip to content

Instantly share code, notes, and snippets.

View victorBaro's full-sized avatar
👾

Victor Baro victorBaro

👾
View GitHub Profile
@jtvargas
jtvargas / MatrixEffect.swift
Created September 9, 2024 01:24
Stress Fiddle App in SwiftUI
//
// MatrixEffect.swift
//
// Created by J.T on 9/8/24.
//
import SwiftUI
import Combine
class MatrixEffectModel: ObservableObject {
@realvjy
realvjy / ChoasLinesShader.metal
Last active August 25, 2024 07:30
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@alikaragoz
alikaragoz / RubberBandSwitch.swift
Created October 12, 2023 12:20
iOS Control Center Rubber Band Swift
import SwiftUI
struct RubberBandSwitch: View {
enum Const {
static let shapeSize: CGSize = .init(width: 90.0, height: 190.0)
static let cornerRadius: CGFloat = 26.0
}
@State var value = 0.5
@stammy
stammy / LiquidBlobs.swift
Last active July 24, 2024 14:49
Liquid Blob effect with SwiftUI
//
// ContentView.swift
// LiquidCircles
//
// Created by Paul Stamatiou on 10/10/22.
//
import SwiftUI
struct ContentView: View {
@skypanther
skypanther / CIFilter+Extension.swift
Created April 8, 2019 20:28 — forked from ha1f/CIFilter+Extension.swift
CIFilter+Extension.swift
//
// Created by はるふ on 2017/12/11.
// Copyright © 2017年 ha1f. All rights reserved.
//
import Foundation
import CoreImage
import AVFoundation
extension CIFilter {
@nicklockwood
nicklockwood / Withable.swift
Created January 28, 2019 12:06
Withable.swift
/// Withable is a simple protocol to make constructing
/// and modifying objects with multiple properties
/// more pleasant (functional, chainable, point-free)
public protocol Withable {
init()
}
public extension Withable {
/// Construct a new instance, setting an arbitrary subset of properties
init(with config: (inout Self) -> Void) {
@smileyborg
smileyborg / InteractiveTransitionCollectionViewDeselection.m
Last active January 15, 2023 13:03
Animate table & collection view deselection alongside interactive transition (for iOS 11 and later)
// UICollectionView Objective-C example
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject];
if (selectedIndexPath != nil) {
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator;
if (coordinator != nil) {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
@tahmmee
tahmmee / opencv_text_detect
Created December 16, 2016 14:29
opencv Text Detection in ios
+ (UIImage*) detectWithImage: (UIImage*) inputImage
{
cv::Mat src = [inputImage CVMat3];
// Extract channels to be processed individually
std::vector<cv::Mat> channels;
cv::text::computeNMChannels(src, channels);
int cn = (int)channels.size();
@MP0w
MP0w / IntrinsicSizeAwareScrollView.swift
Created November 29, 2016 13:47
A `UIScrollView` subclass that adapts its `intrinsicContentSize` to its `contentSize`
import Foundation
import UIKit
/// A `UIScrollView` subclass that adapts its `intrinsicContentSize` to its `contentSize`
final class IntrinsicSizeAwareScrollView: UIScrollView {
private let keyPath = NSStringFromSelector(#selector(getter: contentSize))
override init(frame: CGRect) {
super.init(frame: frame)
@nixta
nixta / AGSSingleFingerZoomGestureRecognizer.swift
Last active March 23, 2021 13:17
A Google-Maps like single-finger zoom gesture for the ArcGIS Runtime SDK for iOS. Awesome idea, Google Maps team! 👏👏👏
//
// AGSSingleFingerZoomGestureRecognizer.swift
//
// Created by Nicholas Furness on 6/17/16.
// Copyright © 2016 Esri. All rights reserved.
//
import Foundation
import ArcGIS