Skip to content

Instantly share code, notes, and snippets.

View phatblat's full-sized avatar

Ben Chatelain phatblat

View GitHub Profile
diff --git a/SwiftGenWMO/Base.lproj/Main.storyboard b/SwiftGenWMO/Base.lproj/Main.storyboard
index 3f93ac0..8bf89f1 100644
--- a/SwiftGenWMO/Base.lproj/Main.storyboard
+++ b/SwiftGenWMO/Base.lproj/Main.storyboard
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
@phatblat
phatblat / build_carthage_framework.rb
Last active March 23, 2016 19:29
Fastlane action to build and archive a framework using Carthage
module Fastlane
module Actions
module SharedValues
CARTHAGE_FRAMEWORK = :CARTHAGE_FRAMEWORK
end
class BuildCarthageFrameworkAction < Action
def self.run(params)
Actions.sh("carthage build --no-skip-current")
Actions.sh("carthage archive #{params[:framework_name]}")
%  carthage build --no-skip-current --platform Mac,iOS --verbose 1 ↵
*** Building scheme "Nimble-OSX" in Nimble.xcodeproj
Build settings from command line:
CODE_SIGN_IDENTITY =
CODE_SIGNING_REQUIRED = NO
ONLY_ACTIVE_ARCH = NO
=== BUILD TARGET Nimble-OSX OF PROJECT Nimble WITH CONFIGURATION Release ===
Check dependencies
@phatblat
phatblat / Fastfile.rb
Last active December 8, 2015 20:11
Fastlane get_info_plist_value action example
# https://gist.github.com/jacobvanorder/74e59f85d2994c151889
desc "Get plist values"
lane :plist do
# plist_file_path = "AppProject/Info.plist" #works
# plist_file_path = sh("xcodebuild -project ../AppProject.xcodeproj -showBuildSettings -configuration Release | grep \"INFOPLIST_FILE\" | sed 's/[ ]*INFOPLIST_FILE = //'") #doesn't work
# dynamically getting the path results in the error `You passed invalid parameters to 'get_info_plist_value'.`
# NOTE: .chomp at end to remove trailing line feed
plist_file_path = sh("xcodebuild -project ../Octopad.xcodeproj -showBuildSettings | grep INFOPLIST_FILE | sed 's/[ ]*INFOPLIST_FILE = //'").chomp
puts plist_file_path
@phatblat
phatblat / NSNotificationCenter.swift
Created December 3, 2015 05:37
Extending postNotificationName to take an enum
extension NSNotificationCenter {
func postNotificationName(notification: Notifications, object: NSObject?) {
postNotificationName(notification.rawValue, object: object)
}
}
@phatblat
phatblat / gist:0dd175b406cf2f3fbfc9
Created August 26, 2015 01:22
xcodebuild -exportOptionsPlist available keys (Xcode 7b6)
Available keys for -exportOptionsPlist:
compileBitcode : Bool
For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES.
embedOnDemandResourcesAssetPacksInBundle : Bool
For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified.
PhaseScriptExecution Run\ Script /Users/phatblat/Library/Developer/Xcode/DerivedData/ObjectiveGitFramework-drtqacfhlqybdcdpqayztrrwneun/Build/Intermediates/ObjectiveGitFramework.build/Debug/libgit2.build/Script-D0A330F116027F2300A616FA.sh
cd /Users/phatblat/dev/libgit2/objective-git
export ACTION=build
export ALTERNATE_GROUP=staff
export ALTERNATE_MODE=u+w,go-w,a+rX
export ALTERNATE_OWNER=phatblat
export ALWAYS_SEARCH_USER_PATHS=NO
export ALWAYS_USE_SEPARATE_HEADERMAPS=YES
export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
export APPLE_INTERNAL_DIR=/AppleInternal
@phatblat
phatblat / gist:b10a463ff40d9dc6a808
Created July 7, 2015 20:29
Darwin notifications in swift
// MARK: - Darwin Notifications
static private let defaultsOnPhoneChangedDarwinNotificationName = "UserDefaultsOnPhoneDidChangeDarwinNotification"
static private let defaultsOnWatchChangedDarwinNotificationName = "UserDefaultsOnWatchDidChangeDarwinNotification"
static var notificationNameForReceiving: String?
static var notificationNameForSending: String?
/// Sets up the broadcast and receiving darwin notification names as well as
/// as the necessary observer callbacks.
@phatblat
phatblat / package-ida.sh
Created May 11, 2015 16:53
A quick script to package up an .ipa correctly since `xcodebuild -exportArchive` misses the required SwiftSupport and WatchKitSupport folders
#!/bin/bash -e
#
# package-ipa.sh
#
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality.
#
xcarchive="$1"
output_ipa="$2"
@phatblat
phatblat / FileTypeForData.m
Created April 21, 2015 15:18
Inspect the first few bytes of an NSData to determine the file type
+ (NSString *)fileTypeForData:(NSData *)data
{
/*
http://www.garykessler.net/library/file_sigs.html
1F 8B 08 .‹.
GZ, TGZ GZIP archive file
50 4B 03 04 PK..
ZIP PKZIP archive file (Ref. 1 | Ref. 2)