Skip to content

Instantly share code, notes, and snippets.

@tera-ny
tera-ny / ContentView.swift
Created September 24, 2020 14:17
How to create a TextView with a ScrollView as a parent in SwiftUI.
import SwiftUI
struct ContentView: View {
var body: some View {
GeometryReader { proxy in
ScrollView(content: {
VStack {
Text("lorem ipsum").bold().font(.title2)
TextView(text: """
https://ja.wikipedia.org/wiki/Lorem_ipsum
@tera-ny
tera-ny / Document.swift
Last active July 30, 2024 19:42
Swift + Combine + Firestore
import Foundation
import FirebaseFirestoreSwift
import FirebaseFirestore
import Combine
struct Document<Model: Codable> {
let ref: DocumentReference
let data: Model
static func get(collectionPath: String, id: String) -> Deferred<Future<Document<Model>, Error>> {
.init { () -> Future<Document<Model>, Error> in
@startuml models
class Article {
title: string
author: string
text: string
description: string
publishedAt: Date
imageURL: string
}
import UIKit
class HomeViewController: UIViewController {
private let uniqueKey: String = "hkjladjgaldkjakjl"
...
override func viewWillAppear(_ animated: Bool) {
super.viewDidLoad()
Scheduler.shared.monitors.updateValue( self, forKey: uniqueKey)
}
@tera-ny
tera-ny / Entity.pu
Last active October 4, 2019 01:54
FoodTicketEntity(仮)
@startuml
class User {
id: String
}
class Shop {
name: String
imageID: String
bussinessHours: BussinessHours
owner: User
products: <String: [Product]>