This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
extension View { | |
func snapshot(targetSize: CGSize = .init(width: 320, height: 480)) -> UIImage { | |
let controller = UIHostingController(rootView: self) | |
let view = controller.view | |
let targetSize = CGSize.init(width: 320, height: 480) | |
view?.bounds = CGRect(origin: .zero, size: targetSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
import SwiftUI | |
class ViewModel: ObservableObject { | |
@Published var count: Int = 0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
import SwiftUI | |
struct ContentView: View { | |
@EnvironmentObject var countSetting: CountSetting | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
import SwiftUI | |
struct ContentView: View { | |
/// 通常のボタン | |
var normalButtonStyle: CustomButtonStyle = .init(isEnabled: true, cornerRadius: 10, color: .blue, disabledColor: .gray, textColor: .white) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PaddingLabel.swift | |
// | |
// Created by Yusuke Hasegawa on 2020/04/25. | |
// Copyright © 2020 Yusuke Hasegawa. All rights reserved. | |
// | |
import UIKit | |
/// UILabel with padding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Prefecture.swift | |
// | |
// Created by Yusuke Hasegawa on 2020/04/25. | |
// Copyright © 2020 Yusuke Hasegawa. All rights reserved. | |
// | |
import Foundation | |
enum Prefecture: String, Codable { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"number": 1, | |
"japanese": "北海道", | |
"english": "hokkaido" | |
}, | |
{ | |
"number": 2, | |
"japanese": "青森県", | |
"english": "aomori" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number | japanese | english | |
---|---|---|---|
1 | 北海道 | hokkaido | |
2 | 青森県 | aomori | |
3 | 岩手県 | iwate | |
4 | 宮城県 | miyagi | |
5 | 秋田県 | akita | |
6 | 山形県 | yamagata | |
7 | 福島県 | fukushima | |
8 | 茨城県 | ibaraki | |
9 | 栃木県 | tochigi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIView { | |
/// corners で指定した場所に角丸処理をする | |
/// | |
/// - Parameters: | |
/// - corners: 角を指定 | |
/// - radius: 角丸の半径 | |
func roundingCorners(_ corners: UIRectCorner, radius: CGFloat) { |
NewerOlder