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 AlertChoiceView: View { | |
@State private var offSet: CGFloat = UIScreen.main.bounds.height/2 | |
@State private var selection: Int = 1 | |
@ObservedObject var viewRouter = ViewRouter() | |
@State private var edge: Edge = Edge.bottom | |
// 画面の閉じる判定 | |
var body: some View { | |
GeometryReader { geometry in |
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 ContentView: View { | |
@State var model = OrientationModel() | |
var body: some View { | |
VStack { | |
Text("Hello, World!") | |
} |
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 ContentView: View { | |
var body: some View { | |
VStack { | |
SetDesgin(c: Color.red) { Text("name") } | |
SetDesgin(c: Color.yellow) {Text("name") } | |
SetDesgin(c: Color.green) {Text("name") } | |
} | |
} |
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 ContentView: View { | |
@State var st: String? | |
var body: some View { | |
DispatchQueue.main.async { | |
self.st = "123" | |
} |
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 ContentView: View { | |
let d = [1,1,1,1,1,1,1,1,1,1] | |
var body: some View { | |
VStack { | |
Text("Sample") | |
}.onAppear { | |
self.d.lazy.map { v in | |
print(v, "lazy") |
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 ContentView: View { | |
@State private var hovering = false | |
var body: some View { | |
Button(action: { | |
self.hovering.toggle() | |
}) { |
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 numArray:[Int?] = [60, 70, 90, nil, 90, 0, 80, 80, 0, 80] | |
check() | |
func check() { | |
for (i, v) in numArray.enumerated() { | |
if ((numArray.firstIndex(where: { _ in 0 != v && v != nil })) != nil) { | |
print("インデックス: \(i)") | |
} | |
} | |
} |
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 ContentView: View { | |
@ObservedObject var bind = STBind() | |
init() { | |
bind.st = "111" | |
} |
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 id = ["111": 111, "222": 222, "333": 333, "444": 444, "555": 555] | |
let thisissorted = id.sorted { (l, r) -> Bool in | |
return l.value < r.value ? false : true | |
} | |
print(thisissorted) |
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 dic = [Dictionary<String, String>.Element]() // Not Syntactic Sugar | |
let dic = [(key: "", value: "")] // Syntactic Sugar |