Skip to content

Instantly share code, notes, and snippets.

View nacho4d's full-sized avatar

Guillermo Ignacio Enriquez Gutierrez nacho4d

View GitHub Profile
@steipete
steipete / UIKitLegacyDetector.m
Last active April 29, 2025 20:17
A simple way to detect at runtime if we're running in UIKit legacy mode or the new "flat" variant. Written for our PDF iOS SDK (http://pspdfkit.com), where the precompiled binary needs to detect at runtime in what variant it's running. Want more stuff like that? Follow me on Twitter: http://twitter.com/steipete
// Taken from http://PSPDFKit.com. This snippet is under public domain.
#define UIKitVersionNumber_iOS_7_0 0xB57
BOOL PSPDFIsUIKitFlatMode(void) {
static BOOL isUIKitFlatMode = NO;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7.
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) {
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0;
}
anonymous
anonymous / UIImage+RoundedCorners.m
Created October 25, 2013 06:18
UIImage with rounded corners
// This could be done using CALayer cornerRadius property
// This is an example of how would be done without that :-)
@interface UIImage (RoundedCorners)
- (UIImage *)roundedImageWithCornerRadius:(CGFloat)cornerRadius;
@end
@implementation UIImage (RoundedCorners)
@maciekish
maciekish / UINavigationBar+CustomHeight.h
Created September 10, 2014 08:48
Custom UINavigationBar height working in iOS 7 and 8. To use, find your navigation bar reference and just setHeight:200 etc.
//
// UINavigationBar+CustomHeight.h
//
// Copyright (c) 2014 Maciej Swic
//
// 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
//
// Punycode.swift
//
// Created by Mike Kasianowicz on 9/7/15.
// Copyright © 2015 Mike Kasianowicz. All rights reserved.
//
import Foundation
public class Punycode {
@Ponyboy47
Ponyboy47 / Logger.swift
Created September 10, 2018 22:15
Proof of Concept of a Swift Logger
import Foundation
import Dispatch
// Special queue for flushing the logs
private let loggingQueue = DispatchQueue(label: "com.logging.queue", qos: .utility)
// The application-wide logger object
public var logger: Logger = GlobalLogger.global
// A global logger which flushes data using the loggingQueue