Skip to content

Instantly share code, notes, and snippets.

View anivaros's full-sized avatar

Vasily Anisimov anivaros

View GitHub Profile
@anivaros
anivaros / 0_UIKitTabView.swift
Last active April 6, 2020 21:16 — forked from Amzd/UIKitTabView.swift
SwiftUI tab bar view that respects navigation stacks when tabs are switched (unlike the TabView implementation)
import SwiftUI
/// An iOS style TabView that doesn't reset it's childrens navigation stacks when tabs are switched.
struct UIKitTabView: View {
var viewControllers: [UIHostingController<AnyView>]
@State var selectedIndex: Int = 0
init(_ views: [Tab]) {
self.viewControllers = views.map {
let host = UIHostingController(rootView: $0.view)
#!/usr/bin/ruby
require 'xcodeproj'
# ============================================
# !!! I've released a ruby gem that does the same thing, but better.
# You can install it by running `gem install xcprovisioner` or
# `sudo gem install xcprovisioner` if it asks for sudo rights.
#
# For more info: https://github.com/thelvis4/XCProvisioner
@anivaros
anivaros / UIView+Swizzle.m
Last active August 29, 2015 14:08
Swizzled -[UIView addSubvew:]
+ (void)loadSwizzle {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Class class = [self class];
// When swizzling a class method, use the following:
// Class class = object_getClass((id)self);
SEL originalSelector = @selector(addSubview:);
SEL swizzledSelector = @selector(my_addSubview:);
@anivaros
anivaros / AutoUpdateVersion.sh
Last active August 29, 2015 14:01
Script for automatic updating version counter in Info.plist and settings files
#!/bin/bash
#
INFOPLIST_FILE=${2};
OIFS=$IFS;
IFS=".";
#считали версию
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildArray=($buildNumber)
IFS=$OIFS;
#import <Foundation/Foundation.h>
@interface URLConnection : NSObject <NSURLConnectionDataDelegate, NSURLConnectionDelegate>
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request
returningResponse:(NSURLResponse **)response
error:(NSError **)error;
@end
@anivaros
anivaros / TestflihtappDeployTeamcity.sh
Created June 21, 2012 13:03 — forked from JohannesRudolph/TestflihtappDeployTeamcity.sh
Builds and deploys an App to testflightapp.com. Integrates with Teamcity.
#!/bin/bash
#
# testflightapp.com tokens
API_TOKEN="YOUR_API_TOKEN"
TEAM_TOKEN="YOUR_TEAM_TOKEN"
PRODUCT_NAME="RowMotion"
ARTEFACTS="$PWD/Artefacts"