Skip to content

Instantly share code, notes, and snippets.

@ppm
ppm / increment-current-project-version.rb
Created October 14, 2019 10:22
Use this in Bitrise's Ruby Script runner step to increment CURRENT_PROJECT_VERSION.
# Gemfile:
#
# source 'https://rubygems.org'
#
# gem 'xcodeproj'
require 'xcodeproj'
project_path = 'Your.xcodeproj'
project = Xcodeproj::Project.open(project_path)
@ppm
ppm / UIColor+iOS13Compatibility.swift
Created June 20, 2019 13:55
An UIColor extension to gracefully adapt iOS 13 system colors: It returns the new system color if available, otherwise a color you specified. Supports Objective-C.
import UIKit
extension UIColor {
@objc
class func systemIndigo(or substitute: UIColor) -> UIColor {
if #available(iOS 13, *) {
return .systemIndigo
} else {
return substitute
@ppm
ppm / gist:2145199d891fd9b064d37e1f66111420
Last active June 17, 2019 06:55
Generate xcconfig to inject iOS 13 compilation condition
if [ $SDK_VERSION_MAJOR -ge 130000 ]; then
CONDITIONS="AVAILABLE_iOS_13 \$(inherited)"
else
CONDITIONS="\$(inherited)"
fi
cat <<_EOT_ > "$PROJECT_DIR/Generated/Custom.xcconfig"
SWIFT_ACTIVE_COMPILATION_CONDITIONS=$CONDITIONS
_EOT_
@ppm
ppm / gist:7254204
Created October 31, 2013 18:07
Response to animated/interactive UIViewController transition.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.transitionCoordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
if ( [context initiallyInteractive] ) return;
[self _onTransitionEnd:context];
}];
[self.transitionCoordinator notifyWhenInteractionEndsUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self _onTransitionEnd:context];
@ppm
ppm / xcode3_theme_to_xcode4.py
Created April 1, 2011 18:26 — forked from emil-palm/xcode3_theme_to_xcode4.py
Changed to support variable destination path.
"""
Script to convert a Xcode3 Color theme into a Xcode4 one.
Example:
bash# python xcode3_theme_to_xcode4.py Twilight.xcolortheme
It will write a new file: Twilight.dvtcolortheme into the same folder as the script is residing in.
"""
import plistlib,sys
""" Define boilerplate of the color theme """
defaultConfig = {