This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import QuartzCore | |
class ConfettiView: UIView { | |
public var colors: [UIColor]! | |
public var intensity: Float! | |
private(set) var active: Bool! | |
override public class var layerClass: Swift.AnyClass { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// We provide some json and transform it to Data-type | |
let json = """ | |
[{ | |
"name": "John", | |
"startingTime": 581167640.06502903 | |
}, { | |
"name": "Mark", | |
"startingTime": 582031640.06502903 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alert = UIAlertController(title: "Sender ...", message: nil, preferredStyle: .alert) | |
let activityIndicator = UIActivityIndicatorView(style: .gray) | |
activityIndicator.translatesAutoresizingMaskIntoConstraints = false | |
activityIndicator.isUserInteractionEnabled = false | |
activityIndicator.startAnimating() | |
alert.view.addSubview(activityIndicator) | |
alert.view.heightAnchor.constraint(equalToConstant: 95).isActive = true | |
activityIndicator.centerXAnchor.constraint(equalTo: alert.view.centerXAnchor, constant: 0).isActive = true |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct EnumPicker<T: Hashable & CaseIterable, V: View>: View { | |
@Binding var selected: T | |
var title: String? = nil | |
let mapping: (T) -> V | |
var body: some View { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct AnimateableView<ContentView: View, Value: VectorArithmetic>: View { | |
let value: Value | |
@ViewBuilder let builder: (Value) -> ContentView | |
var body: some View { | |
builder(value) | |
.modifier(Animation<ContentView, Value>(value: value, builder: builder)) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct IntegerField: View { | |
@Binding var value: Int | |
@State private var stringValue: String | |
init(value binding: Binding<Int>) { | |
self._value = binding | |
self._stringValue = State(wrappedValue: binding.wrappedValue.formatted()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// View+pulsating.swift | |
// | |
// Created by Magnus Jensen on 02/10/2021. | |
// | |
import SwiftUI | |
extension View { | |
func pulsating() -> some View { |
OlderNewer