Skip to content

Instantly share code, notes, and snippets.

@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 Foundation
enum Either<A,B> {
case left(A)
case right(B)
}
// Works only using Swift 4.1
extension Either: Codable where A: Codable, B: Codable {
enum CodingKeys: CodingKey {
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
@kaneshin
kaneshin / main.swift
Last active November 28, 2015 15:20
Swap functions
// Copyright (c) 2014 Shintaro Kaneko
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
@7gano
7gano / info.plist
Last active May 12, 2016 03:53
UILaunchImageName 4画面対応版
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
@natecook1000
natecook1000 / Explore.swift
Last active December 8, 2015 15:25 — forked from erica/gist:06d7e44f4f834757dc36
Swift: Reflection dump
// Original by Erica Sadun
// Source: http://ericasadun.com/2014/06/24/swift-reflection-dump/
import UIKit
import Foundation
func typestring(x : Any) -> String
{
if let obj = x as? NSObject {
return NSStringFromClass((x as NSObject).dynamicType)
@kitasuke
kitasuke / KIF.md
Last active December 28, 2015 00:52
KIF導入

KIF iOS Integration Testing Framework

特徴

導入方法

テスト用ターゲットの追加

テスト用のターゲットを作成する必要があります。 ユニットテストを有効にした場合は、MyApplication_Testsという名前のターゲットが既に存在しているかもしれません。 その場合に、もしそのターゲットをユニットテスト用に使用しないのであれば、そのターゲットをKIF用に使用しても構いません。 それ以外の場合は、以下の手順で新規にターゲットを作成してください。

  1. Xcode上でプロジェクトやターゲット選択欄から、ターゲットの追加を押す
@staltz
staltz / introrx.md
Last active April 24, 2025 06:10
The introduction to Reactive Programming you've been missing
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@hayajo
hayajo / changelog_en.md
Last active April 1, 2025 14:37
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形