Skip to content

Instantly share code, notes, and snippets.

View shahzadmajeed's full-sized avatar
🏠
Working from home

Shahzad Majeed shahzadmajeed

🏠
Working from home
View GitHub Profile
#!/bin/sh
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2
#ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3
#ID='E969541F-E6F9-4D25-8158-72DC3545A6C6' # Xcode 6.3.2
ID=`/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "$(xcode-select -p)/../Info.plist"`
PLIST_BUDDY=/usr/libexec/PlistBuddy
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
function has_compatibility() {
@shahzadmajeed
shahzadmajeed / XcodeBuildSettingsReference.md
Created October 12, 2018 19:07 — forked from tkersey/XcodeBuildSettingsReference.md
The Xcode Build Settings Reference in a searchable document, as of Xcode 8.3.2

Build settings reference

Active Build Action (ACTION)

A string identifying the build system action being performed.

Additional SDKs (ADDITIONAL_SDKS)

The locations of any sparse SDKs that should be layered on top of the one specified by Base SDK (SDKROOT). If more than one SDK is listed, the first one has highest precedence. Every SDK specified in this setting should be a "sparse" SDK, for example, not an SDK for an entire macOS release.

Alternate Install Group (ALTERNATE_GROUP)

@shahzadmajeed
shahzadmajeed / Xcode Customization.md
Created October 12, 2018 19:12
Xcode customizations
  • Xcode build duration defaults write com.apple.dt.Xcode ShowBuildOperationDuration -bool YES
  • Faster build times by leveraging multi-core CPU defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks `sysctl -n hw.ncpu`
  • Flag to emit warnings whenever a function takes longer than some threshold to compile. Add the following to Other Swift Flags
    • -Xfrontend -warn-long-function-bodies=100, where 100 is the number of milliseconds you’d like the warning threshold to be
  • To enable warn about individual expressions that take a long time to type check, go the Build Settings, “Swift Compiler - Custom Flags”, “Other Swift Flags”, and add:
  • -Xfrontend -warn-long-expression-type-checking= where `` is the lower limit of the number of milliseconds that an expression must take to type check in order for the warning to be emitted.
@shahzadmajeed
shahzadmajeed / xcbuild-debugging-tricks.md
Created October 12, 2018 19:14 — forked from tkersey/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

New Build System Tricks

Command Line

# enable internal menu
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
@shahzadmajeed
shahzadmajeed / update-swift-dev
Created October 12, 2018 19:17 — forked from ddunbar/update-swift-dev
This is the script I currently use on OS X to get a working "swift-dev.xctoolchain" out of a built Swift. It isn't designed to work for anyone but me, but it should be easy to adapt. I always run this after every build, and then use `TOOLCHAINS=swift-dev swift build` (etc) to use the development compiler.
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
# Create the development toolchain.
rm -rf ~/public/swift-project/build/Ninja-ReleaseAssert/swift-dev.xctoolchain
@shahzadmajeed
shahzadmajeed / mergegenstrings.py
Created October 12, 2018 20:15 — forked from yoichitgy/mergegenstrings.py
A script to generate .strings file for .swift, .m, .storyboard and .xib files by genstrings and ibtool commands, and merge them with existing translations.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Localize.py - Incremental localization on XCode projects
# João Moreno 2009
# http://joaomoreno.com/
# Modified by Steve Streeting 2010 http://www.stevestreeting.com
# Changes
# - Use .strings files encoded as UTF-8
@shahzadmajeed
shahzadmajeed / Bindings.swift
Created February 15, 2021 00:53 — forked from AliSoftware/Bindings.swift
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
/*:
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI
The only purpose of this code is to implement those wrappers myself
just to understand how they work internally and why they are needed,
⚠️ This is not supposed to be a reference implementation nor cover all
subtleties of the real Binding and State types.
The only purpose of this playground is to show how re-implementing
them myself has helped me understand the whole thing better
@shahzadmajeed
shahzadmajeed / Demo.swift
Created February 15, 2021 00:56 — forked from AliSoftware/Demo.swift
NestableCodingKey: Nice way to define nested coding keys for properties
struct Contact: Decodable, CustomStringConvertible {
var id: String
@NestedKey
var firstname: String
@NestedKey
var lastname: String
@NestedKey
var address: String
enum CodingKeys: String, NestableCodingKey {
import Foundation
protocol TransformerType {
associatedtype BaseType
associatedtype TypeForCoding: Codable
static var encodeTransform: (BaseType) throws -> TypeForCoding { get }
static var decodeTransform: (TypeForCoding) throws -> BaseType { get }
}
@propertyWrapper