Skip to content

Instantly share code, notes, and snippets.

View kishikawakatsumi's full-sized avatar
🏠
Working from home

Kishikawa Katsumi kishikawakatsumi

🏠
Working from home
View GitHub Profile
require 'open3'
stdout, stderr, status = Open3.capture3(*['xcrun', 'xccov', 'view', '--report', '/path.to/result.xcresult', '--json'])
puts stdout # => {...}
@kishikawakatsumi
kishikawakatsumi / TableHeaderView-AutoLayout.swift
Created April 29, 2020 11:19
Auto sizing UITableView header
...
headerView.translatesAutoresizingMaskIntoConstraints = false
tableView.tableHeaderView = headerView
NSLayoutConstraint.activate([
headerView.topAnchor.constraint(equalTo: tableView.topAnchor),
headerView.widthAnchor.constraint(equalTo: tableView.widthAnchor),
headerView.centerXAnchor.constraint(equalTo: tableView.centerXAnchor)])
tableView.tableHeaderView?.layoutIfNeeded()
import Cocoa
import AVFoundation
class ViewController: NSViewController, AVCaptureVideoDataOutputSampleBufferDelegate {
private let session = AVCaptureSession()
override func viewDidLoad() {
super.viewDidLoad()
view.wantsLayer = true
@kishikawakatsumi
kishikawakatsumi / DispatchGroup.swift
Last active February 29, 2020 05:57
Executing asynchronous tasks sequentially in Swift
let q = DispatchQueue(label: "q")
let group = DispatchGroup()
group.enter()
q.async {
loadA(completion: {
// Do something...
group.leave()
})
}
@kishikawakatsumi
kishikawakatsumi / TabView.swift
Created November 27, 2019 04:51
My SwiftUI TabView
import SwiftUI
struct TabView: View {
var views: [TabBarItem]
@State var selectedIndex: Int = 0
init(_ views: [TabBarItem]) {
self.views = views
}
lane :sync_bitrise_yml do
if !ENV['CI']
next
end
Dir.chdir("#{ENV['PWD']}") do
sh "curl -O -H 'Authorization: token #{ENV['BITRISE_ACCESS_TOKEN']}' 'https://api.bitrise.io/v0.1/apps/#{ENV['BITRISE_APP_SLUG']}/bitrise.yml'"
unless system('git diff --quiet --exit-code')
sh 'git add bitrise.yml'
#!/bin/bash
set -exo pipefail
PROJECT_ROOT=$(cd $(dirname $0); cd ..; pwd)
PODS_ROOT="$PROJECT_ROOT/Pods"
PODS_PROJECT="$PODS_ROOT/Pods.xcodeproj"
SYMROOT="$PODS_ROOT/Build"
(cd "$PROJECT_ROOT"; bundle install --path=vendor/bundle --binstubs=vendor/bin)
platform :ios, '10.3'
install! 'cocoapods', integrate_targets: false
inhibit_all_warnings!
use_modular_headers!
target 'Shared' do
use_frameworks!
#!/usr/bin/env bash
git reset --hard
git checkout $1
xcodebuild build -scheme Demo -sdk iphonesimulator -derivedDataPath build
xcrun simctl install 89955894-3580-47CE-86FD-5C3E41850418 ~/work/Demo/build/Build/Products/Debug-iphonesimulator/Demo.app
xcrun simctl install F28EC412-2D31-4F56-9705-670823B8B554 ~/work/Demo/build/Build/Products/Debug-iphonesimulator/Demo.app
#!/bin/sh
set -ex
bundle install --path=vendor/bundle --binstubs=vendor/bin
bundle exec pod install
carthage checkout
carthage build --no-use-binaries --platform ios --cache-builds BonMot
carthage build --no-use-binaries --platform ios --cache-builds bugsnag-cocoa