勉強会で出てきたリンク集
https://designcode.io/swiftui?promo=learnswiftui
kitaさん mobx https://github.com/mobxjs/mobx
| func scaleAndOrient(image: UIImage) -> UIImage { | |
| // Set a default value for limiting image size. | |
| let maxResolution: CGFloat = 640 | |
| guard let cgImage = image.cgImage else { | |
| print("UIImage has no CGImage backing it!") | |
| return image | |
| } |
| struct ContentView: View { | |
| var body: some View { | |
| NavigationView { | |
| NavigationLink(destination: Text("sdetail")) { | |
| Text("master") | |
| .navigationBarTitle("nav", displayMode: .inline) | |
| } | |
| .navigationBarTitle("nav", displayMode: .large) | |
| Text("detassssssil") |
| Button(action: doSomething) { | |
| Text("Default padding") | |
| .padding() | |
| .background(Color.yellow) | |
| } |
| // | |
| // ContentView.swift | |
| // TryGeometryReader | |
| // | |
| // Created by satoutakeshi on 2019/12/07. | |
| // Copyright © 2019 satoutakeshi. Licensed under MIT. | |
| // | |
| import SwiftUI |
| struct ContentView: View { | |
| var body: some View { | |
| TabView { | |
| NavigationView { | |
| NavigationLink(destination: Text("Next Page")) { | |
| BlueView() | |
| } | |
| } | |
| .navigationBarTitle(Text("Landmarks")) | |
| .tabItem { |
勉強会で出てきたリンク集
https://designcode.io/swiftui?promo=learnswiftui
kitaさん mobx https://github.com/mobxjs/mobx
| //: A UIKit based Playground for presenting user interface | |
| import UIKit | |
| import PlaygroundSupport | |
| class MyViewController : UIViewController { | |
| override func loadView() { | |
| let view = UIView() | |
| view.backgroundColor = UIColor.blue |
| let today = Date() //2018年12月18日に実行 | |
| // 中国の農暦 = 旧暦 | |
| let chineseCalendar = Calendar(identifier: .chinese) | |
| let comp = chineseCalendar.dateComponents([.year, .month, .day], from: today) | |
| print(comp.debugDescription) | |
| // year: 35 month: 11 day: 12 isLeapMonth: false |
| // 旧暦(農暦) | |
| let chine = Calendar(identifier: .chinese) |
| // インデックス番号を入れたらその番号のフィボナッチ数を出力 | |
| func fib(index: Int) -> Int { | |
| guard index > 1 else { return 1 } | |
| var a = 1 | |
| var b = 1 | |
| (2...index).forEach { (index) in | |
| (a, b) = (a + b, a) | |
| } | |
| return a |