Skip to content

Instantly share code, notes, and snippets.

佐藤剛士 SatoTakeshiX

View GitHub Profile
@SatoTakeshiX
SatoTakeshiX / ContentView.swift
Last active Jun 14, 2020
AVFundation by SwiftUI with Coordinator.
View ContentView.swift
struct ErrorInfo: Error {
var showError: Bool
var message: String
}
struct ContentView: View {
@State var errorInfo: ErrorInfo = ErrorInfo(showError: false, message: "")
@State var onAppear: Bool = false
var body: some View {
ZStack {
View scaleAndOrient.swift
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
}
View ContentView.swift
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(destination: Text("sdetail")) {
Text("master")
.navigationBarTitle("nav", displayMode: .inline)
}
.navigationBarTitle("nav", displayMode: .large)
Text("detassssssil")
@SatoTakeshiX
SatoTakeshiX / CodePiece.swift
Created Dec 23, 2019
SwiftUIのButtonのタップ領域を広げるにはViewの方をpaddingする #CodePiece #SwiftUI
View CodePiece.swift
Button(action: doSomething) {
Text("Default padding")
.padding()
.background(Color.yellow)
}
@SatoTakeshiX
SatoTakeshiX / convert.swift
Last active Jun 25, 2020
Take capture a view by SwiftUI
View convert.swift
//
// ContentView.swift
// TryGeometryReader
//
// Created by satoutakeshi on 2019/12/07.
// Copyright © 2019 satoutakeshi. All rights reserved.
//
import SwiftUI
@SatoTakeshiX
SatoTakeshiX / CodePiece.swift
Created Nov 26, 2019
TabbarとNavigationの組み合わせ、SwiftUIでうまくいかないぞ。。 #CodePiece #SwiftUI
View CodePiece.swift
struct ContentView: View {
var body: some View {
TabView {
NavigationView {
NavigationLink(destination: Text("Next Page")) {
BlueView()
}
}
.navigationBarTitle(Text("Landmarks"))
.tabItem {
@SatoTakeshiX
SatoTakeshiX / read.md
Last active Jul 9, 2019
ゴリゴリキャッチアップSwiftUI
@SatoTakeshiX
SatoTakeshiX / convert.swift
Created May 29, 2019
UIView convert method
View convert.swift
//: 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
View file0.swift
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
@SatoTakeshiX
SatoTakeshiX / CodePiece.swift
Created Dec 18, 2018
Calendar型の.chineseは旧暦、中国の農暦を表すとのこと #swift #CodePiece
View CodePiece.swift
// 旧暦(農暦)
let chine = Calendar(identifier: .chinese)
You can’t perform that action at this time.