Skip to content

Instantly share code, notes, and snippets.

@Shebuka
Shebuka / AVAudioSession+Switch.h
Created April 4, 2017 09:22
AVAudioSession extension for easy switch between categories and session activation and deactivation with error check and logging.
//
// AVAudioSession+Switch.h
//
// Created by Anton Shebukov on 09/06/16.
// Copyright (c) 2013-2017 Feedback Italia S.r.l. All rights reserved.
//
#import <AVFoundation/AVFoundation.h>
@Shebuka
Shebuka / xcode-version-date-increment.sh
Created June 30, 2016 10:25
XCode auto increment build version and build date in both plist and settings bundle
# Set path to plist files
infoPlist=${INFOPLIST_FILE}
settingsPlist="appName/Resources/Settings.bundle/Root.plist"
# Get some values from info.plist and generate current date
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$infoPlist")
CFBuildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" "$infoPlist")
CFBuildDate=$(date '+%Y-%m-%d %H:%M:%S %z')
# Increment build
@Shebuka
Shebuka / MapViewController.mm
Last active March 2, 2016 18:23
Sanitization of latitude and longitude for correct CLLocationCoordinate2D/CLLocation creation and use in MKPointAnnotation or MKMapView.
- (instancetype)initWithLatitude:(NSString *)aLatitude
longitude:(NSString *)aLongitude
completionHandler:(ASLocationMediaItemCompletionBlock)aCompletion {
NSParameterAssert(aLatitude != nil);
NSParameterAssert(aLongitude != nil);
self = [super initWithLatitude:aLatitude longitude:aLongitude];
if (self) {
CLLocationCoordinate2D locCoord = CLLocationCoordinate2DMake([aLatitude floatValue], [aLongitude floatValue]);