Skip to content

Instantly share code, notes, and snippets.

View acegreen's full-sized avatar

Ace Green acegreen

  • Montreal, Canada
View GitHub Profile
@tdhop
tdhop / gist:5846707
Last active March 28, 2017 13:22
Simple method for creating expanding UITableView rows that expand in an animated fashion when accessory button is tapped. What you do with the extra space in the expanded row is up to you.
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Detail Disclosure Tapped");
// Set expanded cell then tell tableView to redraw with animation
self.expandedRow = indexPath;
[self.tableView beginUpdates];
[self.tableView endUpdates];
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
@guilhermearaujo
guilhermearaujo / UISegmentedControl+Multiline.h
Created June 9, 2014 20:46
UISegmentedControl+Multiline
//
// UISegmentedControl+Multiline.h
//
// Created by Guilherme Araújo on 6/9/14.
// Copyright (c) 2014 Guilherme Araújo. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UISegmentedControl (Multiline)
@cromandini
cromandini / universal-framework.sh
Last active February 12, 2024 12:13 — forked from cconway25/gist:7ff167c6f98da33c5352
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
@igordeoliveirasa
igordeoliveirasa / gist:78a310f0348fcad9b270
Created March 26, 2015 01:41
iOS Loading Overlay View - SWIFT
//
// LoadingOverlay.swift
// app
//
// Created by Igor de Oliveira Sa on 25/03/15.
// Copyright (c) 2015 Igor de Oliveira Sa. All rights reserved.
//
// Usage:
//
// # Show Overlay
######################
# Options
######################
NULL=
REVEAL_ARCHIVE_IN_FINDER=false
FRAMEWORK_NAME="${PROJECT_NAME}"
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"
@johnlinvc
johnlinvc / basketball.swift
Created April 11, 2016 15:58
basket ball shooting in spritekit
//: Playground - noun: a place where people can play
/*
README
just copy & paste the code into an iOS playground of Xcode 7.3+
click display timeline to play in the liveview
*/
import UIKit
import SpriteKit
@pascalgiguere
pascalgiguere / importParseJson.js
Created May 12, 2016 23:24
Node.js script using the Parse REST API to import a JSON file to Parse. Useful when dropping an entire class then reloading it from a JSON backup (Parse export). Will also update pointers of a second Parse class pointing to the imported class so that pointers don't break despite the imported data having different objectIds.
var PARSE_APPLICATION_ID = '';
var PARSE_REST_API_KEY = '';
var JSON_FILE_PATH = ''; // Path to JSON file to import
var IMPORTED_CLASS_NAME = ''; // Class to import
var POINTING_CLASS_NAME = ''; // Class with pointers to imported class
var POINTING_CLASS_PROPERTY = ''; // Name of pointer property
var request = require('request');
var fs = require('fs');
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class Responder: NSObject {
@objc func segmentedControlValueChanged(_ sender: UISegmentedControl) {
UIView.animate(withDuration: 0.3) {
buttonBar.frame.origin.x = (segmentedControl.frame.width / CGFloat(segmentedControl.numberOfSegments)) * CGFloat(segmentedControl.selectedSegmentIndex)
}
@frankfka
frankfka / iOSActivityRingSwiftUI.swift
Created April 29, 2020 05:22
iOS Activity Ring in SwiftUI
import SwiftUI
import PlaygroundSupport
extension Double {
func toRadians() -> Double {
return self * Double.pi / 180
}
func toCGFloat() -> CGFloat {
return CGFloat(self)
@mecid
mecid / Calendar.swift
Last active May 8, 2024 13:30
SwiftUI Calendar view using LazyVGrid
import SwiftUI
extension Calendar {
func generateDates(
inside interval: DateInterval,
matching components: DateComponents
) -> [Date] {
var dates: [Date] = []
dates.append(interval.start)