Skip to content

Instantly share code, notes, and snippets.

View webserveis's full-sized avatar

Webserveis webserveis

View GitHub Profile
@coughski
coughski / MeshGradientEditor.swift
Created June 17, 2024 02:36
SwiftUI Mesh Gradient Editor
import SwiftUI
import UniformTypeIdentifiers
struct MeshGradientPoint: Identifiable {
let id = UUID()
var point: SIMD2<Float>
var color: Color
}
struct ContentView: View {
@lostincode
lostincode / ContentView.swift
Created June 15, 2024 00:24
MeshGradient Playground iOS 18
//
// ContentView.swift
// MeshGradientPlayground
//
// Created by Bill Richards on 6/14/24.
//
import SwiftUI
struct ContentView: View {
@Matt54
Matt54 / AnimatingMaskedMeshView.swift
Created June 13, 2024 12:21
An animating mesh gradient view with an animating mask
import SwiftUI
struct AnimatingMaskedMeshView: View {
let referenceDate: Date = .now
@State private var mainPosition: CGPoint = .zero
@State private var positions: [CGPoint] = []
private let blurRadius = 20.0
private let alphaThreshold = 0.875
@metasidd
metasidd / PillButtons.swift
Last active June 30, 2024 02:45
Pill Buttons - Mail App iOS 18 - SwiftUI
//
// PillButtons.swift
//
// Created by Siddhant Mehta on 6/11/24
// Twitter: @metasidd
//
// Feel free to reuse, or remix.
import SwiftUI
@peantunes
peantunes / GroundReflectionViewModifier-final.swift
Last active July 27, 2024 13:21
Reflection effect for SwiftUI
private struct GroundReflectionViewModifier: ViewModifier {
let offsetY: CGFloat
func body(content: Content) -> some View {
content
.background(
content
.mask(
LinearGradient(
gradient: Gradient(stops: [.init(color: .white, location: 0.0), .init(color: .clear, location: 0.6)]),
startPoint: .bottom,
@jong9000
jong9000 / mac-shortcuts.md
Last active December 15, 2021 12:13
macOS collection of shortcuts and commands

Mac Keyboard Symbols

symbol name
command
option
control
shift
tab
↩︎ return
@oohyugi
oohyugi / RecycleviewAdapter
Last active August 29, 2020 07:24
Live template recycerview adapter , Type cmd + shift + A to find action , enter Add Template and press Enter button. Preferences window with File and Code Templates tab will be opened. Press ctrl + N to add a new template. Name it ,, RecyclerView Adapter “ and add the following code:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
#parse("File Header.java")
@DenysZP
DenysZP / UseCase.kt
Created March 28, 2019 12:06
The implementation of the base UseCase with kotlin coroutines.
import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext
abstract class UseCase<T, Params : Any> {
private lateinit var parentJob: Job
private lateinit var params: Params
private var isAttachedToLifecycle = false
private val backgroundContext: CoroutineContext = Dispatchers.IO
private val foregroundContext: CoroutineContext = Dispatchers.Main
@yuntan
yuntan / FloatSeekBarPreference.kt
Last active August 22, 2024 21:17
SeekBarPreference for Float with value formatter
package com.example.app
import android.content.Context
import android.content.res.TypedArray
import android.util.AttributeSet
import android.widget.SeekBar
import android.widget.TextView
import androidx.preference.Preference
import androidx.preference.PreferenceViewHolder
import android.app.Application
import android.arch.lifecycle.LiveData
import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import android.net.NetworkInfo
import android.net.NetworkRequest
import android.os.Build
import android.support.annotation.RequiresPermission
import android.support.annotation.VisibleForTesting