Skip to content

Instantly share code, notes, and snippets.

@izakpavel
izakpavel / LightningView.swift
Created December 3, 2020 07:34
Lightnings in SwiftUI
//
// Lightnings fun
//
// BEWARE highly unoptimized!
//
// Created by Pavel Zak on 30/11/2020.
//
import SwiftUI
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// by @levelsio
// HOW TO
// 1) Make a Google Sheet, we'll pull the first cell e.g. A1
// 2) Publish your Google Sheet, File -> Publish To Web
// 3) Copy the SHEET_ID in the URL, put it in here below:
const endpoint = "https://spreadsheets.google.com/feeds/cells/SHEET_ID/1/public/full?alt=json"
// 4) Install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
// 5) Copy this entire script in to Scriptable (tip: you can send it to your iPhone via Whatsapp/Messenger/Telegram etc)
@izakpavel
izakpavel / RotatorView.swift
Created November 18, 2020 09:08
a SwiftUI recreation of an interesting animation by @beesandbombs
//
// RotatorView.swift
//
// Created by Pavel Zak on 16/11/2020.
// original idea by: https://twitter.com/beesandbombs/status/1326312738033983489?s=20
//
import SwiftUI
func pow(_ x: Int, _ y: Int) -> Int {
@Snowy1803
Snowy1803 / ContentView.swift
Last active December 31, 2024 11:53
This code allows you to use matchedGeometryEffect in SwiftUI while keeping iOS 13 compatibility in your app.
//
// ContentView.swift
// Example of using matchedGeometryEffect in iOS 13 code
// matchedGeometryEffect example code taken and adapted from :
// https://sarunw.com/posts/a-first-look-at-matchedgeometryeffect/
//
// Created by Emil Pedersen on 16/10/2020.
//
struct ContentView: View {

Upcoming Matches ⚽

This easy widget let's you see upcoming matches of your favourite football team.

Guide

  1. Copy this code in a new script in Scriptable app
  2. Find teamId here: https://site.api.espn.com/apis/site/v2/sports/soccer/:league/teams
  3. Find league id: some league abbreviation (EX: 'eng.1' for EPL, 'usa.1' for MLS, 'ned.1' for Dutch Eredivisie)
  4. Change competitionId variable (line 4) with your competition id
  5. Change teamId variable (line 5) with your favourite team id
@izakpavel
izakpavel / LoadingIndicatorAppleEventStyle.swift
Created October 2, 2020 10:07
A loading indicator in the style of this years Apple Event animation. Created for the first #SwiftUIWeeklyChallenge
//
// ContentView.swift
// SwiftUIWeeklyChallenge01
//
// Created by @myridiphis on 02/10/2020.
//
// not very tidy, but enjoy changing many of magical constants
import SwiftUI
@truizlop
truizlop / CircleWave.swift
Created September 29, 2020 15:43
Circle wave animation
import SwiftUI
struct CircleWave: Shape {
let N = 360
let SPEED: Double = 1 / 1000.0
let SHIFT: Double = 2 * Double.pi / 3
let FREQUENCY: Double = 8
var factor: Double
var colorIndex: Double
@truizlop
truizlop / Wave.swift
Created September 10, 2020 14:41
Wave animation using SwiftUI
import SwiftUI
let LINE_LENGTH: Double = 500.0
let N = 720
let LINES = 18
let WAVES: Double = 18.0
let WAVE_HEIGHT: Double = 20
let SPACING: Double = 27.0
let CURL_AMOUNT: Double = 12.0
@CodeSlicing
CodeSlicing / AnimeStyleChatDemo.swift
Last active August 3, 2020 07:51
Demo showing anime inspired chat bubbles, completely in SwiftUI. Requires Xcode 12 and PureSwiftUI 2.0.0-beta-1
//
// AnimeStyleChatDemo.swift
//
// 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:
//
import SwiftUI
import PlaygroundSupport
struct whatsNewRow: View {
var icon: String
var title: String
var description: String
var body: some View {
HStack (spacing: 24) {