Skip to content

Instantly share code, notes, and snippets.

View denisenepraunig's full-sized avatar

Denise Nepraunig denisenepraunig

View GitHub Profile
@denisenepraunig
denisenepraunig / Content.view
Created November 26, 2023 18:59
SwiftUI Card with glowing edges inside app with subtle blur background
//
// ContentView.swift
// GradientCard
//
// Created by Denise Nepraunig on 26.11.23.
//
import SwiftUI
struct GradientLine: View {
@denisenepraunig
denisenepraunig / ContentView.swift
Created November 25, 2023 01:45
SwiftUI Metal Shader changing background color based on mouse position
import SwiftUI
struct ContentView: View {
@State private var hoverLocation: CGPoint = .zero
@State private var isHovering = false
@State var toggleText = false
var body: some View {
ZStack {
Rectangle()
@denisenepraunig
denisenepraunig / SwitchTuple.swift
Created June 17, 2021 13:00
Switch over multiple variables
import Foundation
enum FooEnum {
case foo1
case foo2
case foo3
}
enum BarEnum {
case bar1
@denisenepraunig
denisenepraunig / ContentView.swift
Created May 28, 2021 10:54
Number Converter - Day 19: 100 Days of SwiftUI #100daysOfSwiftUI
import SwiftUI
struct ContentView: View {
@State private var numberString = "0"
private var numberInt: Int {
Int(numberString) ?? 0
}
private var numberHex: String {
@denisenepraunig
denisenepraunig / Stack.swift
Created May 26, 2021 09:13
Example UnitTests for a Stack in Swift
import Foundation
public struct Stack<Element> {
private var storage = [Element]()
public init() {}
public init(_ elements: [Element]) {
storage = elements
}
@denisenepraunig
denisenepraunig / BreathAnimation.swift
Last active November 1, 2023 00:21
Apple Watch Breath Animation in SwiftUI - modified pink edition
//
// BreathAnimation.swift
// breathing-animation
//
// Created by Denise Nepraunig on 17.05.21.
//
// Code is based on this tutorial:
// https://www.youtube.com/watch?v=KUvkJOhpB9A
// Thanks Adam :-)
@denisenepraunig
denisenepraunig / ShortCutTrainer.swift
Created April 4, 2021 16:25
Mini Prototype for an Xcode Shortcut Trainer
//
// ShortCutTrainer.swift
// xcode-shortcut-trainer
//
// Created by Denise Nepraunig on 04.04.21.
//
import SwiftUI
struct ShortCutTrainer: View {
@denisenepraunig
denisenepraunig / DotIndicator.swift
Created March 29, 2021 15:43
SwiftUI Activity Indicator Sine Dots
import SwiftUI
struct DotIndicator: View {
@State private var isLoading = false
var body: some View {
HStack(spacing: 10) {
ForEach(0...4, id: \.self) { index in
Circle()
.frame(width: 20, height: 20)
@denisenepraunig
denisenepraunig / SimpleCombineCat.swift
Created December 23, 2020 14:03
My very first and very simple example on how to use write some simple Combine concepts from scratch end to end. Can run in a Playground.
import Foundation
import Combine
var storage = Set<AnyCancellable>()
struct Cat: Codable {
let name: String
let age: Int
}
@denisenepraunig
denisenepraunig / MouseButtonSwitch.scpt
Last active September 11, 2019 07:40
swap right and left mouse button apple magic mouse macOS Mojave
# https://apple.stackexchange.com/questions/89721/swap-mouse-button-using-applescript
# this is my first script - so maybe some things are not the best way to do it 🙈
# I didn't use defaults -currentHost write .GlobalPreferences com.apple.mouse.swapLeftRightButton -bool false
# because you need to logout and login again
# ATTENTION: sometimes it works, sometimes it doesn't - I don't know why
# Hints would be really appreciated ;-)
# error "System Events got an error: Can’t get tab group 1 of window 1 of application process \"System Preferences\". Invalid index." number -1719 from tab group 1 of window 1 of application process "System Preferences"