Skip to content

Instantly share code, notes, and snippets.


Daiki Matsudate d-date

View GitHub Profile
View CoreSpotlight.swift
import CoreSpotlight
import Foundation
#if canImport(UniformTypeIdentifiers)
import UniformTypeIdentifiers
import MobileCoreServices
struct ShopIndexHandler {
static let `default` : ShopIndexHandler = .init()
View Combine+UIKit.swift
import Combine
import UIKit
public protocol CombineCompatible {}
// MARK: - UIControl
public extension UIControl {
final class Subscription<SubscriberType: Subscriber, Control: UIControl>: Combine.Subscription where SubscriberType.Input == Control {
private var subscriber: SubscriberType?
private let input: Control
View UIImage+GIF.swift
import UIKit
import ImageIO
extension UIImage {
public static func gifImage(data: Data) -> UIImage? {
guard let source = CGImageSourceCreateWithData(data as CFData, nil) else {
print("image doesn't exist")
return nil
d-date / project.yml
Last active Feb 23, 2021
XcodeGen Example
View project.yml
name: XXXX
LastUpgradeCheck: 1140
bundleIdPrefix: com.xxxx.xxxxxxxx
iOS: 13.1.3
Develop Debug: debug
View NotAllCodingKeys.swift
import Foundation
let intJson = #"{ "inUse": 1, "name": "Daiki Matsudate", "twitter": "d_date", "stars": 99999, "occupation": null}"#
let boolJson = #"{ "inUse": true, "name": "Daiki Matsudate", "twitter": "d_date", "stars": 99999, "occupation": null}"#
protocol Inherits {
associatedtype SuperType
var `super`: SuperType { get }
View RxSwiftQuiz.swift
let of = Observable.of(1,2,3)
.do(onNext: { print($0) })
let just = Observable.just(4)
.do(onNext: { print($0) })
let error = Observable<Any?>.error(FakeError())
.do(onError: { print($0) }), just, error)
.disposed(by: disposeBag)
View VStackViewController.swift
import UIKit
open class VStackViewController: UIViewController {
public let scrollView: UIScrollView = .init()
public let stackView: UIStackView = {
let stackView: UIStackView = .init()
stackView.axis = .vertical
stackView.alignment = .fill
stackView.distribution = .equalSpacing
stackView.spacing = 0
View WKWebViewController.swift
import UIKit
import WebKit
class WKWebViewController: UIViewController {
var request: URLRequest?
weak var uiDelegate: WKUIDelegate?
weak var navigationDelegate: WKNavigationDelegate?
lazy var webView: WKWebView = {
View UIView+Layout.swift
import UIKit
typealias Constraint = (UIView, UIView) -> NSLayoutConstraint
func equal<L, Axis>(_ to: KeyPath<UIView, L>, constant: CGFloat = 0, priority: UILayoutPriority? = nil) -> Constraint where L: NSLayoutAnchor<Axis> {
return equal(to, to, constant: constant, priority: priority)
func equal<L, Axis>(_ from: KeyPath<UIView, L>, _ to: KeyPath<UIView, L>, constant: CGFloat = 0, priority: UILayoutPriority? = nil) -> Constraint where L: NSLayoutAnchor<Axis> {
return { view1, view2 in
d-date / Podfile
Created Apr 11, 2019
Specify swift version for each targets individually
View Podfile
pre_install do |installer|
installer.pod_targets.each do |target|
if ['Mockingjay', 'URITemplate'].include?
target.root_spec.swift_version = '4.2'
target.root_spec.swift_version = '5.0'