- close #0
- #0
| [alias] | |
| vacuum = "!f () { git checkout $1; git branch --merged|egrep -v '\\*|develop|main'|xargs git branch -d; git fetch --prune; };f" |
| import Foundation | |
| // MARK: 1. 1〜10の配列を用意する | |
| print( | |
| (1...10).map{ $0 } | |
| ) | |
| // MARK: 2. 1〜10の合計を求める forEach | |
| var result: Int = 0 | |
| (1...10).map{ $0 }.forEach { (value: Int) in |
| import _Concurrency | |
| // MARK: Class | |
| print("------------------ CLASS ------------------------") | |
| // class だと順番がぐちゃぐちゃになることがある 1 -> 8 まで順番に出力されない(データ競合) | |
| class ClassCounter { | |
| static var shared = ClassCounter() | |
| private init() {} |
| // | |
| // LineDivider.swift | |
| // | |
| // | |
| // Created by hira22 on 2021/08/13. | |
| // | |
| import SwiftUI | |
| struct LineDivider: View { |
| import SwiftUI | |
| import UIKit | |
| class SwiftUIViewInUITableViewCell: UITableViewCell { | |
| static var reuseIdentifier: String { String(describing: self) } | |
| private var hostingController: UIViewController! | |
| func setup<Content: View>(view: Content) { | |
| self.hostingController = UIHostingController(rootView: view) |
| import Combine | |
| import UIKit | |
| class SampleViewController: UIViewController { | |
| private var cancellables: Set<AnyCancellable> = [] | |
| @IBOutlet private var sampleView: UIView! | |
| override func viewDidLoad() { |
| import SwiftUI | |
| struct PlaceHolderTextEditor: View { | |
| var placeholderText: String | |
| @State var text: String | |
| var body: some View { | |
| ZStack(alignment: .topLeading) { | |
| if text.isEmpty { | |
| Text(placeholderText) |
| // メニューバーにアクションを設定する | |
| function onOpen() { | |
| const spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
| const entries = [ | |
| { | |
| name: "このシートをJSONファイルに変換&出力", | |
| functionName: "exportJSON" | |
| } | |
| ]; | |
| spreadsheet.addMenu("JSON変換", entries); |
| import Foundation | |
| enum Gender { | |
| case female | |
| case male | |
| case other | |
| } | |
| let array = [ | |
| (name: "Shun", gender: Gender.male), |