Skip to content

Instantly share code, notes, and snippets.

View ochim's full-sized avatar

munehiro ochi ochim

View GitHub Profile
@ochim
ochim / SwitchViewControllerProtocol.md
Created April 6, 2020 11:30
[iOS]SwitchViewControllerProtocol
protocol SwitchViewControllerProtocol: UIViewController {
    var childViewController: UIViewController? {get set}
}

extension SwitchViewControllerProtocol {

    func switchChildViewController(_ viewController: UIViewController) {
        childViewController = viewController
@ochim
ochim / ignore-check-certificate.md
Last active March 5, 2020 08:17
[Android]SSLでアクセスした際に証明書チェックがエラーになっても無理やり表示する

WebViewでhttpsのサイトにアクセスした際に証明書チェックがエラーになっても無理やり表示する

mWebView.setWebViewClient(new WebViewClient() {
    @Override
    public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {  
            handler.proceed();  
        }  
    } 
@ochim
ochim / SFSafariViewController.md
Last active February 18, 2020 11:41
SFSafariViewController
@ochim
ochim / ios-snapshot.md
Last active February 5, 2020 11:39
[iOS]コードでスナップショットを撮る
// UIScrollView全体のスナップショット
// https://gist.github.com/thestoics/1204051
extension UIScrollView {
     public var snapshot: UIImage? {
         UIGraphicsBeginImageContextWithOptions(contentSize, false, 0)
         defer {
             UIGraphicsEndImageContext()
         }
         guard let context = UIGraphicsGetCurrentContext() else { return nil }
@ochim
ochim / 2019last-Android-iOS-Test-Night.md
Last active January 21, 2020 13:56
年末だよ Android/iOS Test Night
@ochim
ochim / GDG-DevFest-Tokyo-2019.md
Created December 26, 2019 09:39
GDG DevFest Tokyo 2019 振り返り

GDG DevFest Tokyo 2019

参加したセッション

Goの並行処理を体験してみよう

  • 会場のwifiが混みすぎてほぼ使えない。自前でwifiを持っていくべし
@ochim
ochim / ViewController.swift
Created December 5, 2019 05:59
[HealthKit]ヘルスケアデータにアクセスし、水泳のワークアウト、水泳のストローク数を取得し、出力する
import UIKit
import HealthKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
guard HKHealthStore.isHealthDataAvailable() else {
return
}
@ochim
ochim / UIColor-hex.md
Created November 27, 2019 03:58
UIColorをカラーコードで生成する
import UIKit

extension UIColor {
    convenience init(hex: String, alpha: CGFloat) {
        let v = Int("000000" + hex, radix: 16) ?? 0
 let r = CGFloat(v / Int(powf(256, 2)) % 256) / 255
@ochim
ochim / UITextField-attributedText-Tips.md
Created November 15, 2019 09:07
[ios]テキストを下寄せかつ、複数のフォントを混ぜて表示する
//  下寄せ
valueField.contentVerticalAlignment = .bottom

let stringAttributes1: [NSAttributedString.Key: Any] = [
    .foregroundColor: UIColor.black,
    .font: UIFont.systemFont(ofSize: 30.0)
]
let string1 = NSAttributedString(string: v, attributes: stringAttributes1)
@ochim
ochim / looking-back-over-the-last-ten-years.md
Last active September 26, 2019 11:03
Looking back over the last 10 years

2009

  • 価格比較、ランキングアプリ(iOS Obj-C)

2010

  • 囲碁アプリ(iOS Obj-C)
  • 生理日管理アプリ(iOS Obj-C)

2011

  • 生理日管理アプリ(iOS Obj-C)

2012

  • トレーディングカードアプリ(iOS Obj-C)

2013