Skip to content

Instantly share code, notes, and snippets.

View webserveis's full-sized avatar

Webserveis webserveis

View GitHub Profile
import SwiftUI
// Remember to download FontSettings.swift
struct WWDC24AnimatedTextView: View {
var text = "Hello, World!"
var animation: Animation = .easeInOut
var targetFontSize: CGFloat = 40
var minimumFontSize: CGFloat = 30
var targetFontWeight: Font.Weight = .semibold
@webserveis
webserveis / MeshGradientEditor.swift
Created June 17, 2024 06:51 — forked from coughski/MeshGradientEditor.swift
SwiftUI Mesh Gradient Editor
import SwiftUI
import UniformTypeIdentifiers
struct MeshGradientPoint: Identifiable {
let id = UUID()
var point: SIMD2<Float>
var color: Color
}
struct ContentView: View {
@webserveis
webserveis / ContentView.swift
Created June 16, 2024 11:43 — forked from lostincode/ContentView.swift
MeshGradient Playground iOS 18
//
// ContentView.swift
// MeshGradientPlayground
//
// Created by Bill Richards on 6/14/24.
//
import SwiftUI
struct ContentView: View {
@webserveis
webserveis / AnimatingMaskedMeshView.swift
Created June 13, 2024 13:07 — forked from Matt54/AnimatingMaskedMeshView.swift
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
@webserveis
webserveis / ContentView.swift
Created July 31, 2023 15:43 — forked from dkun7944/ContentView.swift
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
@webserveis
webserveis / SeparatorTextView.java
Created February 3, 2023 18:54 — forked from alphamu/SeparatorTextView.java
Demonstration of how to make a custom TextView which has a separator running across it. Screenshot of TextView https://raw.githubusercontent.com/alphamu/RxAndroidDemo/master/app/SeparatorTextViewSample.png
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.TextView;
/**
* Simple version used in the article:
@webserveis
webserveis / KIntent.kt
Created February 12, 2021 12:28 — forked from wajahatkarim3/KIntent.kt
Kotlin extension functions to start a generic Activity
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@webserveis
webserveis / RVEmptyObserver.java
Last active February 1, 2021 18:02 — forked from sheharyarn/RVEmptyObserver.java
Set Empty Layout for RecyclerViews in Android
/**
* https://stackoverflow.com/questions/28217436/how-to-show-an-empty-view-with-a-recyclerview
*
* Custom implementation of AdapterDataObserver to show empty layouts
* for RecyclerView when there's no data
*
* Usage:
*
* adapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerView, emptyView));
*/
@webserveis
webserveis / KIntent.kt
Created August 14, 2020 13:40 — forked from passsy/KIntent.kt
Kotlin extension functions to start a generic Activity
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@webserveis
webserveis / UseCase.kt
Created April 22, 2020 15:33 — forked from DenysZP/UseCase.kt
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