This file contains hidden or 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
// | |
// ContentView.swift | |
// sandbox | |
// | |
// Created by vlad on 21/11/2023. | |
// | |
import SwiftUI | |
enum Route { |
This file contains hidden or 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
// Enum.swift | |
// | |
// Copyright (c) 2014-present FontAwesome.swift contributors | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
This file contains hidden or 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
// | |
// SimpleClient.swift | |
// | |
// Created by Sarp Solakoglu on 18/09/2017. | |
// Copyright ยฉ 2017 Sarp Solakoglu. All rights reserved. | |
// | |
import Foundation | |
enum RestMethod: String { |
This file contains hidden or 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
//1 , cant be right as assigning instance variable does not make a copy | |
var fooBar = self.fooBar | |
fooBar.forEach({ foo in | |
if foo.id == bar.id { | |
fooBar.remove(at: fooBar.index(of: foo)!) | |
} | |
}) | |
self.fooBar = fooBar | |
//2, seems right as enumerated makes a copy |
This file contains hidden or 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
public func RegexValidationWithMessage(_ message:String, regex:String, allowingNull:Bool = true) -> Validation<String>? { | |
if let regex = try? NSRegularExpression(pattern: regex, options: .CaseInsensitive) { | |
return Validation<String>(message: message, validation: { (value) -> Bool in | |
let nullValidation = NonEmptyStringValidation("") | |
guard let stringValue = value else { | |
return false | |
} | |
This file contains hidden or 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)mouseDown:(NSEvent*)event | |
{ | |
//create a NSPasteboardItem | |
NSPasteboardItem *pbItem = [NSPasteboardItem new]; | |
[pbItem setDataProvider:self forTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, nil]]; | |
//create a new NSDraggingItem with our pasteboard item. | |
NSDraggingItem *dragItem = [[NSDraggingItem alloc] initWithPasteboardWriter:pbItem]; | |
NSPoint dragPosition = [self convertPoint:[event locationInWindow] fromView:nil]; |
This file contains hidden or 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
@implementation LaunchButton | |
- (id)initWithFrame:(NSRect)frame { | |
self = [super initWithFrame:frame]; | |
if (self) { | |
// Initialization code here. | |
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingInVisibleRect owner:self userInfo:nil]; | |
[self addTrackingArea:area]; | |
This file contains hidden or 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
float lastTick = 0.0; | |
for (int i = 0; i <= 900; i++) { | |
float t = [self tickX:9 timesOfTotal:900 current:i lastTick:lastTick]; | |
if (t > 0) { | |
NSLog(@"%f %i",t,i); | |
lastTick = t; | |
} | |
} |
This file contains hidden or 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
NSView *parent = [[NSView alloc] initWithFrame:NSZeroRect]; | |
NSView *child = [[NSView alloc] initWithFrame:NSZeroRect]; | |
[parent addSubview:child]; | |
[child setWantsLayer:YES]; | |
CALayer *childLayer = [child layer]; | |
CATransformLayer *transformLayer = [CATransformLayer layer]; | |
[transformLayer addSublayer:childLayer]; | |
[parent setWantsLayer:YES]; | |
NSLog(@"%@",childLayer); | |
NSLog(@"%@",transformLayer.sublayers); |
This file contains hidden or 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
[image setWantsLayer:YES]; | |
CALayer *flayer = [image layer]; | |
[flayer removeAllAnimations]; | |
[backImage setWantsLayer:YES]; | |
CALayer *blayer = [backImage layer]; | |
[blayer removeAllAnimations]; | |
NSView *superView = [image superview]; | |
[superView setWantsLayer:YES]; |
NewerOlder