Skip to content

Instantly share code, notes, and snippets.

View ColdGrub1384's full-sized avatar

Emma Cold ColdGrub1384

View GitHub Profile
@steventroughtonsmith
steventroughtonsmith / MRDMenuView.h
Created March 1, 2020 17:21
Simplified iOS menu view wired up to UIMenuBuilder
//
// MRDMenuView.h
// MobileRadio
//
// Created by Steven Troughton-Smith on 29/02/2020.
// Copyright © 2020 High Caffeine Content. All rights reserved.
//
#import <UIKit/UIKit.h>
@steipete
steipete / UIWindow+PSPDFAdditions.h
Last active June 5, 2024 20:09
Mac Catalyst: Get the NSWindow from a UIWindow (Updated for macOS 11 Big Sur, also works with Catalina)
// Don't forget to prefix your category!
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIWindow (PSPDFAdditions)
#if TARGET_OS_UIKITFORMAC
@sahara-ooga
sahara-ooga / HaveXcode9RenderMarkdown.md
Created November 26, 2017 09:18
Have Xcode 9 render markdown

Have Xcode 9 render markdown

To make Xcode 9 render markdown file eg. README.md, drop .xcodesamplecode.plist in your .xcodeproj/ folder. .xcodesamplecode.plist is like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <array/> </plist>

For convenience, There is this tool, which is derived from a tutorial.

@cprovatas
cprovatas / BlockBasedSelector.h
Last active June 9, 2024 13:08
Block-Based Selectors in Swift
//
// BlockBasedSelector.h
//
// Created by Charlton Provatas on 11/2/17.
// Copyright © 2017 CharltonProvatas. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BlockBasedSelector : NSObject
@fahied
fahied / MyWKWebVC.Swift
Created January 10, 2017 06:46
WKWebView controller example with progress bar
//
// MyWKWebVC.Swift
// Example
//
// Created by Fahied on 04/01/2017.
//
import Foundation
import UIKit
import WebKit
@shu223
shu223 / CustomActivity.swift
Last active November 4, 2020 17:59
Custom UIActivity in Swift 3
import UIKit
class CustomActivity: UIActivity {
override class var activityCategory: UIActivityCategory {
return .action
}
override var activityType: UIActivityType? {
guard let bundleId = Bundle.main.bundleIdentifier else {return nil}
@CodyKochmann
CodyKochmann / install_StaSh.py
Created September 25, 2016 20:22
install StaSh on pythonista for iOS to get pip working
# from https://forum.omz-software.com/topic/1919/stash-shell-like-an-expert-in-pythonista
# this script will get pip working on iOS!
import requests as r
exec(r.get('http://bit.ly/get-stash').text)
anonymous
anonymous / build_freetype.sh
Created July 16, 2016 04:04
Compile-Freetype-For-iOS
#!/bin/bash
# Compile-Freetype-For-iOS
# Original Script https://github.com/jkyin/Compile-Freetype-For-iOS/blob/master/build_freetype.sh
# Revised by: l'L'l
#
# New Features Include: auto download latest version, fixed toolchain locations, other various tweeks
#
# The MIT License (MIT)
# Copyright (c) 2016 l'L'l
@camdenfullmer
camdenfullmer / CMFWallpaper.m
Last active February 18, 2024 03:05
Set the wallpaper (lock and/or home screen) on iOS using Apple's private API. Please be aware that including this code in an App Store submission will result in a rejection. This has only been tested on iOS 9.2.
@implementation CMFWallpaper
+ (void)setImage:(UIImage *)image {
NSAssert([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized, @"access to photos is needed to set the wallpaper");
NSString *path;
#if TARGET_OS_SIMULATOR
path = @"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibrary.framework";
#else
path = @"/System/Library/PrivateFrameworks/PhotoLibrary.framework";
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let showAlertButton = UIButton(type: UIButtonType.Custom)
showAlertButton.frame = CGRectMake(0, 0, 100, 40)
showAlertButton.setTitle("Show Alert", forState: .Normal)