Skip to content

Instantly share code, notes, and snippets.

View unnamedd's full-sized avatar
🇺🇦
#StandWithUkraine

Thiago Holanda unnamedd

🇺🇦
#StandWithUkraine
View GitHub Profile
@unnamedd
unnamedd / PreviewDevice+ListOfPads.swift
Created April 25, 2020 18:19
A small extension for PreviewDevice to avoid enter the values in the SwiftUI previews manually
/**
* PreviewDevice+ListOfPads.swift
* Copyright (c) Thiago Holanda 2020
* https://twitter.com/tholanda
*
* MIT license
*/
import SwiftUI
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
protocol KeyPathUpdatable {}
extension KeyPathUpdatable {
func updating<LeafType>(_ keyPath: WritableKeyPath<Self, LeafType>, to value: LeafType) -> Self {
var copy = self
copy[keyPath: keyPath] = value
return copy
}
}
// The SwiftUI Lab
// Website: https://swiftui-lab.com
// Article: https://swiftui-lab.com/alignment-guides
import SwiftUI
class Model: ObservableObject {
@Published var minimumContainer = true
@Published var extendedTouchBar = false
@Published var twoPhases = true
@unnamedd
unnamedd / UIView+Tooltips.h
Created September 15, 2019 00:53 — forked from steventroughtonsmith/UIView+Tooltips.h
WIP tooltips for Mac Catalyst
//
// UIView+Tooltips.h
// Crossword
//
// Created by Steven Troughton-Smith on 13/09/2019.
// Copyright © 2019 Steven Troughton-Smith. All rights reserved.
//
#import <UIKit/UIKit.h>
@unnamedd
unnamedd / MyService.swift
Created August 8, 2019 13:27 — forked from mminer/MyService.swift
Components of XPC service.
import Foundation
class MyService: NSObject, MyServiceProtocol {
func upperCaseString(_ string: String, withReply reply: @escaping (String) -> Void) {
let response = string.uppercased()
reply(response)
}
}
@unnamedd
unnamedd / MacEditorTextView.swift
Last active April 16, 2024 10:18
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@unnamedd
unnamedd / TextStyleButtons.swift
Last active July 1, 2019 22:34
[SwiftUI] Text style buttons
//
// ContentView.swift
// TestsWithSwiftUI
//
// Created by Thiago Holanda on 01.07.19.
// Copyright © 2019 unnamedd codes. All rights reserved.
//
import SwiftUI
@unnamedd
unnamedd / TextBorderBottom.swift
Last active September 11, 2023 21:54
[SwiftUI] Text + Border Bottom
var body: some View {
Group {
Text(language.name)
.font(.body)
.padding([.leading, .trailing], 10)
.padding([.top, .bottom], 5)
.background(Color.gray)
.overlay(
Rectangle()
.frame(height: 4)
@unnamedd
unnamedd / TextFieldTyped.swift
Last active October 9, 2022 21:05
[SwiftUI] Wrapping a UITextField into SwiftUI to use different keyboards, e.g: UIKeyboardType.twitter, UIKeyboardType.numbersAndPunctuation
// Created by Thiago Holanda on 22.06.19.
// twitter.com/tholanda
import SwiftUI
struct ContainerView: View {
@State var decimal = ""
@State var twitter = ""
@State var url = ""
@State var search = ""