Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Focusing

Dbank daisukenagata

:octocat:
Focusing
View GitHub Profile
View gist:cb9b6c7de171eff3acb60bf4adb9fcbd
var tx: String?
/// クロージャー機能 bindTx引数に文字、もしくはnilを取得します。
let notify = { (_ bindTx: String?) -> String? in return bindTx }
/// クロージャーを返却する機能
/// - Parameter bind: Voidを返却
func closureBind(_ bind: @escaping () -> Void) {
tx = "test"
View gist:302d4966e01c68723dae09c151c9707e
//
// ViewController.swift
// SampleObserve
//
// Created by 永田大祐 on 2019/11/12.
// Copyright © 2019 永田大祐. All rights reserved.
//
import UIKit
View gist:5002c49061f18d72e0a40dfda1290b1a
import SwiftUI
struct ContentView: View {
@State var text: String = ""
@State var text2: String = ""
@State var spacing: CGFloat = 0
View gist:50a90621dd68e5353786a643315088b6
import UIKit
import SwiftUI
struct ContentView: View {
@State var text: String = ""
@State var text2: String = ""
@State var spacing: CGFloat = 0
View gist:253ae79692234dbf89d042f5010f2387
import UIKit
final class UnderLineTextField: UITextField {
private var border: CALayer
override init(frame: CGRect) {
border = CALayer()
super.init(frame: .zero)
}
View gist:720e7a29c7f7dae9b692747167c1a28b
import SwiftUI
struct ContentView: View {
var body: some View {
let first = Restaurant(id: 0, name: "0")
let second = Restaurant(id: 1, name: "1")
let third = Restaurant(id: 2, name: "2")
let restaurants = [first, second, third]
View gist:81fee237dcccf60e19a4f1da2829ac65
import Combine
import SwiftUI
struct ContentView: View {
@ObservedObject var viewModel = OrientationModel()
var body: some View {
let first = Restaurant(id: 0 ,score: 0.0, login: "a")
let second = Restaurant(id: 1 ,score: 0.0, login: "b")
let third = Restaurant(id: 2 ,score: 0.0, login: "c")
View gist:ab6a7e176cf05c7494794ae75d43a045
import SwiftUI
struct ContentView: View {
@ObservedObject var viewModel = OrientationModel()
let cardView = CardView(card: Card.example)
var body: some View {
ScrollView(.horizontal) {
HStack(spacing: 0) {
View gist:e89d1cd160f0298b7958e5efb761cfda
public struct ItemUniqueID: Hashable
{
var sectionIDHash: Int
var itemIDHash: Int
init<SectionID: Hashable, ItemID: Hashable>(sectionID: SectionID, itemID: ItemID)
{
sectionIDHash = sectionID.hashValue
itemIDHash = itemID.hashValue
}
}
View gist:e4158a471a0e8d2943d7dcd5e14ba4c5
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello").modifier(MyModifier(color: .yellow,
frameSize: 100, // frmae is size
verticalSet: .top, // originY
horizontalSet: .trailing, // originX
verticalSize: 100, // originY size
horizontalSize: 100)) // originX size