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 MessageInput: View { | |
@State private var text = "" | |
@FocusState private var isFocused: Bool | |
var body: some View { | |
HStack { | |
TextField("Enter your message…", text: $text) | |
.textFieldStyle(.roundedBorder) |
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 NumberTextField<NumberType: BinaryInteger>: View { | |
private let title: LocalizedStringKey | |
private let range: ClosedRange<NumberType>? | |
private let format: IntegerFormatStyle<NumberType> | |
@Binding private var value: NumberType? | |
@State private var valueString: String = "" |
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
/* | |
How to use the content of this gist: | |
- Create a new iOS app using the "App" template, | |
set the product name to "Demo", use "SwiftUI" for interface and enable Core Data. | |
- go to the apps target (=click the Project "Demo" and select "Demo" as under "Targets") | |
- select the "Info" tab |
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
// | |
// ContentView.swift | |
// Bug-Combine-Leak | |
// | |
import Combine | |
import SwiftUI | |
final class Store: ObservableObject { | |
struct User: Codable { |
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 AVFoundation | |
// Get test video from bundle | |
let url = Bundle.main.url(forResource: "test", withExtension: "mp4")! | |
let anAsset = AVURLAsset(url: url) | |
// get properties of video track | |
let track = anAsset.tracks(withMediaType: AVMediaType.video).first! | |
let size = track.naturalSize.applying(track.preferredTransform) | |
let frameSize = CGSize(width: abs(size.width), height: abs(size.height)) |
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
// | |
// ContentView.swift | |
// Project13 | |
// | |
// Created by Paul Hudson on 17/02/2020. | |
// Copyright © 2020 Paul Hudson. All rights reserved. | |
// | |
import CoreImage | |
import CoreImage.CIFilterBuiltins |
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
#!/bin/zsh | |
# Shell Script to create all relevant icons from an high resolution artwork | |
if [ "x$1" != "x" -a -f "$1" ] ; then | |
INPUT=$1 | |
else | |
INPUT="Artwork.png" | |
fi | |
if [ ! -f "$INPUT" ]; then |