Skip to content

Instantly share code, notes, and snippets.

View DaisukeNagata's full-sized avatar
:octocat:
Focusing

EveryDaySoft DaisukeNagata

:octocat:
Focusing
View GitHub Profile
@DaisukeNagata
DaisukeNagata / SimpleDesign_SwiftUI.swift
Last active March 22, 2021 14:12
SimpleDesign_SwiftUI.swift
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Color.yellow
.frame(maxWidth: .infinity, maxHeight: .infinity)
VStack {
HStack {
@DaisukeNagata
DaisukeNagata / String_Split.swift
Created March 7, 2021 22:35
String_Split.swift
import UIKit
var str = "Hell12o, p3laygrou4.5nd"
var ans = ""
str.forEach { s in
if (s.description.range(of: "[0-9-.]",
options: .regularExpression,
range: nil,
locale: nil) != nil) {
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_0" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@DaisukeNagata
DaisukeNagata / gist:082955c365f263bd9c17a76d5041153f
Last active February 27, 2021 22:43
FirebaseAppCrashlytics
func FirebaseAppCrashlytics() {
FirebaseApp.configure()
Crashlytics.crashlytics()
Crashlytics.crashlytics().setCrashlyticsCollectionEnabled(true)
let userInfo = [
NSLocalizedDescriptionKey: NSLocalizedString("The request failed.", comment: ""),
NSLocalizedFailureReasonErrorKey: NSLocalizedString("The response returned a 404.", comment: ""),
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString("Does this page exist?", comment: ""),
import SwiftUI
final class TextModel: ObservableObject {
@Published var roomIndex = Array<String>()
}
struct ContentView: View {
@State private var tag : Int?
@State private var view: AnyView?
@DaisukeNagata
DaisukeNagata / gist:fd31ca57b69a68a899b686110ef869c8
Last active February 27, 2021 22:45
SwiftUIList_CardVersion
import SwiftUI
final class ViewModel: ObservableObject {
@Published var spIndex = [""]
}
struct ContentView: View {
@ObservedObject var viewModel = ViewModel()
init() {
import SwiftUI
import Combine
struct LanguageResponse: Decodable {
var statusCode: Int
var body: String
}
struct ContentView: View {
@DaisukeNagata
DaisukeNagata / gist:91d78147e3df42b342d0b33a2ea91fde
Created August 14, 2020 02:34
SwiftUI_Representable_Camera
import SwiftUI
import AVFoundation
struct ContentView: View {
var body: some View {
RepresentableViewController()
}
}
struct ContentView_Previews: PreviewProvider {
@DaisukeNagata
DaisukeNagata / gist:a4c09e9e87dbcb7b27a9c98b8166e787
Created August 13, 2020 12:38
RepresentableViewController
import SwiftUI
struct ContentView: View {
var body: some View {
RepresentableViewController(view: HelloWorldColorView())
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
let array = [1, 2, 3, 4, 5]
let total = array.map { $0 }.reduce(.zero, +)
let average = array.map { $0 }.reduce(.zero, +)/array.count
print(total)
print(average)