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
UIImageWriteToSavedPhotosAlbum(_currentVC.imageView.image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); | |
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error | |
contextInfo:(void *)contextInfo | |
{ | |
// Was there an error? | |
if (error != NULL) | |
{ | |
UIAlertView *alert = [[UIAlertView alloc] init]; | |
[alert setTitle: @"Error, try again"]; |
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 SimpleViewController: UIViewController, StoryboardInstantiable{ | |
typealias ViewController = SimpleViewController | |
static var storyboardID: String { get { return "SimpleViewController" } } | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
} |
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 <UIKit/UIKit.h> | |
@protocol StoryboardInstantiable <NSObject> | |
+ (NSString *)storyboardID; | |
@end | |
@interface UIViewController (StoryboardInstantiable) |
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
// создаём элемент худа | |
HUDItem *item = [HUDItem itemWithTitle:@”Title” andDetail:@”Test”]; | |
// Возможные настройки | |
item.hideDelay = 2.0; // время показа | |
item.imageType = HUDImage_SadFace; // картинка | |
item.dimBackground = YES; // затемнять фон | |
item.mode = ProgressHUDModeText; // тип hud’a | |
// Показать созданый item |
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) setProgress:(float) value; | |
- (void) setDetailText:(NSString *) text; | |
- (void) updateHudView:(UIView *) hudView; | |
- (void) showAlwaysOnTop; |
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
HUDItem *item = [HUDItem itemWithTitle:@”Nice heart” andDetail:@”Smile bitch!”]; | |
item.hudCustomImagePath = @”hudTest.png”; | |
item.hideDelay = 7.0; | |
[ALHUDManager showHUD:item]; |
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
// init localized manager | |
ALLocalizedInit | |
// Update current index by index | |
ALLocalizationSetLanguageByIndex(language) | |
// set language (example "ru","en") | |
ALLocalizationSetLanguage(language) | |
// return "ru","en" and etc. |
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
let pred = NSPredicate(format: "slug = 'default'") | |
if let item: FolderData = databaseProvider.firstObject(type: DataModelType.folderData, predicate: pred) { | |
let realm = RealmConfigurator.shared.reamInstance() | |
try! realm.write { | |
item.mapping(map: Map(mappingType: .fromJSON, JSON: ["test": "Whaaaat?"])) | |
} | |
} | |
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 Array { | |
func sortByArray<T, Z: Hashable>(of ids:[Z], | |
keyType: Z.Type, | |
idClosure: (_ obj: T) -> (Z)) -> [T] { | |
var dict = [Z: T]() | |
guard let arr = self as? [T] else { | |
return [] | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
// Models | |
struct UniverseType { | |
static let marvel = MarvelHero.self | |
static let dc = DCHero.self | |
} |
OlderNewer