This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://blog.human-friendly.com/drawing-images-from-pixel-data-in-swift | |
// https://github.com/FlexMonkey/MetalReactionDiffusion/blob/1ea9aa4a841d20e0b247505fdf716cd5fe1a01fd/MetalReactionDiffusion/ViewController.swift | |
public struct PixelData { | |
var a:UInt8 = 255 | |
var r:UInt8 | |
var g:UInt8 | |
var b:UInt8 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UDvars { | |
var AppLaunch: Int = UserDefaults.standard.object(forKey: "AppLaunch") as? Int ?? 0 { | |
didSet { | |
UserDefaults.standard.set(AppLaunch, forKey: "AppLaunch") | |
} | |
} | |
var Bool: Bool = UserDefaults.standard.object(forKey: "Bool") as? Bool ?? false { | |
didSet { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension AVCaptureVideoDataOutput { | |
var availableVideoCVPixelFormatTypedEnums: [OSTypedEnum] { | |
let availablePixelFormatDescriptions: Array<OSType> = self.availableVideoCVPixelFormatTypes as! Array<OSType> | |
let availablePixelFormats: Array<OSTypedEnum> = availablePixelFormatDescriptions.map { OSTypedEnum(rawValue: $0)! } | |
return availablePixelFormats | |
} | |
} | |
enum OSTypedEnum: OSType { | |
case monochrome1 = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- ( id ) methodWithOneParam:( id ) theParam { | |
// Do amazing stuff | |
return @"Srsly, Amazing!"; | |
} | |
- ( id ) methodWithFirst:( id ) firstParam | |
andSecond:( id ) secondParam | |
{ | |
// Do doubly amazing stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// HKWUIDeviceHardware.h | |
// | |
#import <Foundation/Foundation.h> | |
@interface HKWUIDeviceHardware : NSObject | |
- (NSString *) platform2; | |
- (NSString *) platformString; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (void)describePreferredFonts | |
{ | |
static NSArray *textStyles; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
textStyles = @[UIFontTextStyleHeadline, | |
UIFontTextStyleSubheadline, | |
UIFontTextStyleBody, | |
UIFontTextStyleFootnote, | |
UIFontTextStyleCaption1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AVAsset+VideoOrientation.h | |
// | |
// Created by Luca Bernardi on 19/09/12. | |
// Copyright (c) 2012 Luca Bernardi. All rights reserved. | |
// | |
#import <AVFoundation/AVFoundation.h> | |
typedef enum { | |
LBVideoOrientationUp, //Device starts recording in Portrait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIView *) huntedSubviewWithClassName: (NSString *) className | |
{ | |
if ([[[self class] description] isEqualToString: className]) | |
{ | |
return self; | |
} | |
for (UIView *subview in self.subviews) | |
{ | |
UIView *huntedSubview = [subview huntedSubviewWithClassName: className]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface UIImage(ImmediateLoad) | |
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path; | |
@end | |
@implementation UIImage(ImmediateLoad) | |
+ (UIImage*)imageImmediateLoadWithContentsOfFile:(NSString*)path { | |
UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSNotificationCenter (AllObservers) | |
- (NSSet *) my_observersForNotificationName:(NSString *)notificationName; | |
@end |
NewerOlder