Skip to content

Instantly share code, notes, and snippets.

Advanced Animations with UIKit
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/230lc4n1loob9/230/230_hd_advanced_animations_with_uikit.mp4?dl=1
pdf: https://devstreaming-cdn.apple.com/videos/wwdc/2017/230lc4n1loob9/230/230_advanced_animations_with_uikit.pdf
Advanced Touch Bar
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/222ijxk2akkrebmr/222/222_hd_advanced_touch_bar.mp4?dl=1
pdf: https://devstreaming-cdn.apple.com/videos/wwdc/2017/222ijxk2akkrebmr/222/222_advanced_touch_bar.pdf
Advances in TVMLKit
video: https://devstreaming-cdn.apple.com/videos/wwdc/2017/202ximbb9e2dq222/202/202_hd_advances_in_tvmlkit.mp4?dl=1

Create an iOS app with Swift Package Manager dependencies

CAUTION: This information is mostly obsolete. Xcode 11 allows a project to directly declare its Swift Package Manager dependencies.

This gist walks through creating an Xcode project for an iOS app that consumes packages in Swift Package Manager (SPM).

We'll be using Xcode 10.2 and Swift 5.

Scenario

@Danesz
Danesz / AppDelegateSwizzler.swift
Created January 6, 2021 22:39 — forked from hpinhal/AppDelegateSwizzler.swift
Performing some swizzling magic on your AppDelegate
import UIKit
private typealias ApplicationDidBecomeActive = @convention(c) (Any, Selector, UIApplication) -> Void
private typealias ApplicationWillResignActive = @convention(c) (Any, Selector, UIApplication) -> Void
private struct AssociatedObjectKeys {
static var originalClass = "MyFramework_OriginalClass"
static var originalImplementations = "MyFramework_OriginalImplementations"
}
@Danesz
Danesz / XXXRootListController.m
Created June 7, 2020 09:49 — forked from Galactic-Dev/XXXRootListController.m
Show a custom version of Apple's native OBWelcomeController when opening a preference bundle.
/*The file that you modify is the XXXRootListController.m file in your
preference bundle directory (XXX being the three characters that you chose for your preference bundle */
//I'm interfacing all the classes you'll need here. But don't forget to change $(BUNDLE_NAME)_PRIVATE_FRAMEWORKS = Preferences to $(BUNDLE_NAME)_PRIVATE_FRAMEWORKS = Preferences OnBoardingKit
#include "XXXRootListController.h"
@interface OBButtonTray : UIView
- (void)addButton:(id)arg1;
- (void)setStackViewTopConstraint:(NSLayoutConstraint *)arg1;
- (NSLayoutConstraint *)stackViewTopConstraint;
@Danesz
Danesz / Tweak.x
Created May 14, 2020 21:50
AVCaptureSession Jailbreak hook
#import <UIKit/UIKit.h>
%hook SpringBoard
-(void) applicationDidFinishLaunching:(id)arg {
%orig(arg);
UIAlertView *lookWhatWorks = [[UIAlertView alloc] initWithTitle:@"PrivacyGuard Tweak"
message:@"Your privacy guard is running 😎"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
@Danesz
Danesz / CameraViewControllerHidden.swift
Created May 14, 2020 21:47
CameraViewControllerHidden.swift - init
// ...
do {
deviceInput = try AVCaptureDeviceInput(device: captureDevice)
guard deviceInput != nil else {
print("error: can't get deviceInput")
return
}
if self.session.canAddInput(deviceInput){
self.session.addInput(deviceInput)
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:45
CameraViewController.swift - photoOutput
func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) {
//process single image
guard let imageData = photo.fileDataRepresentation()
else { return }
let captureImageView = UIImageView(frame: CGRect(x: 50, y: 50, width: 100, height: 100))
let image = UIImage(data: imageData)
captureImageView.image = image
//show the captured image
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:44
CameraViewController.swift - captureOutput
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
// do stuff here with the video
}
@Danesz
Danesz / CameraViewController.swift
Last active May 14, 2020 21:42
CameraViewController.swift - init
var deviceInput: AVCaptureDeviceInput!
session.sessionPreset = AVCaptureSession.Preset.vga640x480
// acquire the camera device
guard let device = AVCaptureDevice
.default(AVCaptureDevice.DeviceType.builtInWideAngleCamera,
for: .video,
position: AVCaptureDevice.Position.front) else {
return
@Danesz
Danesz / CameraViewController.swift
Created May 14, 2020 21:39
CameraViewController.swift - AVCaptureSession
let session = AVCaptureSession()