Skip to content

Instantly share code, notes, and snippets.

View unknown-undefined's full-sized avatar

Undefined unknown-undefined

View GitHub Profile
@unknown-undefined
unknown-undefined / UIControl+Block.swift
Last active September 16, 2021 02:23
UIControl block call back
import UIKit
extension UIControl {
/// add handler for specific `UIControl.Event`
func addEvent(_ event: UIControl.Event, handler: @escaping (UIControl) -> Void) {
let holder = EventHandlerHolder(action: handler)
retainHolder(holder, for: event)
addTarget(holder, action: #selector(holder.invokeHandler), for: event)
}
//
// SectionBackgroundFlowLayout.swift
//
// Created by Samuel's on 2020/7/29.
import UIKit
@objc protocol SectionBackgroundFlowLayoutDelegate: NSObjectProtocol {
func sectionsNeedBackgroundColor(in collectionView: UICollectionView, layout: UICollectionViewFlowLayout) -> [Int]
func classForBackgroundViewAttributes() -> UICollectionViewLayoutAttributes.Type

Core Data

  • -com.apple.CoreData.SQLDebug 1-3 - print all SQL queries called by Core Data
    • -com.apple.CoreData.Logging.stderr 1-3 - needed alongside with the SQLDebug from iOS 10+ because of new logging system, more on that in changelog
  • -com.apple.CoreData.SyntaxtColoredLogging YES - probably syntax colored logging (not tried)
  • -com.apple.CoreData.SQLiteDebugSynchronous 1 - preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details
  • -com.apple.CoreData.SQLiteIntegrityCheck 1 - the SQLite store does extra integrity checking
  • -com.apple.CoreData.MigrationDebug 1 - Core Data will log information about exceptional cases as it migrates data
  • -com.apple.CoreData.ThreadingDebug - preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where incre
@unknown-undefined
unknown-undefined / GitConfigHttpProxy.md
Created November 12, 2018 06:53 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

##In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@unknown-undefined
unknown-undefined / swift
Last active November 8, 2018 10:11
fix UINavigationBar NavigationItems margins >= iOS11
// do common initilizer
class BaseNavigationController: UINavigationController {
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
fixNavigationItemsMargin()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
fixNavigationItemsMargin()