Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
struct TagListView<Data: Collection, Content: View>: View where Data.Element: Hashable {
let items: Data
let itemSpacing: CGFloat
let lineSpacing: CGFloat
let alignment: HorizontalAlignment
let content: (Data.Element) -> Content
@State private var width: CGFloat = 0
struct ContentView: View {
var body: some View {
ZStack(alignment: .top) {
B.black.opacity(0.2)
}
ScrollView(showsIndicators: false) {
Button {
print(">>>> tap button")
} label: {
Text("Button")
@shtnkgm
shtnkgm / BauhausBookDesign.swift
Created June 15, 2021 00:47
BauhausBookDesign.swift
import SwiftUI
struct ContentView: View {
let width: CGFloat = 80
var body: some View {
VStack(spacing: 0) {
Spacer()
HStack {
Color.blue.frame(width: width)
@shtnkgm
shtnkgm / regionNameWithEmoji.swift
Created May 22, 2021 23:44
regionNameWithEmoji
import Foundation
extension Locale {
var regionEmoji: String? {
guard let regionCode = regionCode else { return nil }
return regionCode
.unicodeScalars
.map({ 127397 + $0.value })
.compactMap(UnicodeScalar.init)
.map(String.init)
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink("Button1", destination: ChildView())
}
.navigationViewStyle(StackNavigationViewStyle())
}
@shtnkgm
shtnkgm / UnicodeNormalization.swift
Created September 6, 2019 16:00
Unicode normalization
import Foundation
// NSStringのプロパティ
// decomposed
// 分解した
// precomposed
// 構成済み
@shtnkgm
shtnkgm / AsyncProgramming.swift
Created November 18, 2018 02:42
非同期処理
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
DispatchQueue.main.async {
print("メインスレッドで非同期実行")
}
DispatchQueue(label: "").async {
print("サブスレッド(直列キュー)で非同期実行")
@shtnkgm
shtnkgm / RaspberryPiJenkinsSetup.md
Last active November 21, 2023 15:01
Raspberry Pi Jenkins環境構築
@shtnkgm
shtnkgm / .gitignore
Last active October 8, 2018 07:28
.gitignore ios templete
### wget https://bit.ly/shtnkgmgi2 -O .gitignore
### https://gist.githubusercontent.com/shtnkgm/dfe0a0478a15de11ce93ca6f39223cd5/raw/.gitignore
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/