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 View { | |
/// Adds a double click handler this view (macOS only) | |
/// | |
/// Example | |
/// ``` | |
/// Text("Hello") | |
/// .onDoubleClick { print("Double click detected") } | |
/// ``` | |
/// - Parameters: | |
/// - handler: Block invoked when a double click is detected |
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 SwiftUI | |
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable { | |
// MARK: - Coordinator | |
final class Coordinator: NSObject, UIScrollViewDelegate { | |
// MARK: - Properties | |
private let scrollView: UIScrollView | |
var offset: Binding<CGPoint> |
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
// | |
// PagerView.swift | |
// | |
// Created by Majid Jabrayilov on 12/5/19. | |
// Copyright © 2019 Majid Jabrayilov. All rights reserved. | |
// | |
import SwiftUI | |
struct PagerView<Content: View>: View { | |
let pageCount: Int |
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 | |
import Combine | |
@propertyWrapper | |
final class UserDefault<Wrapped>: NSObject, ObservableObject { | |
typealias Validator = (Wrapped) -> (Wrapped) | |
private let suite: UserDefaults | |
private let key: String |
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
struct User: Codable { | |
var firstName: String | |
var lastName: String | |
var lastLogin: Date? | |
} | |
@propertyWrapper | |
struct Storage<T: Codable> { | |
private let key: String | |
private let defaultValue: T |
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
//------------------------------------------------------------------------ | |
// The SwiftUI Lab: Advanced SwiftUI Animations | |
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths) | |
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect) | |
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier) | |
//------------------------------------------------------------------------ | |
import SwiftUI | |
struct ContentView: View { | |
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
/* | |
<samplecode> | |
<abstract> | |
Utility classes to manage audio formats and buffers for an audio unit implementation's input and output audio busses. | |
</abstract> | |
</samplecode> | |
*/ | |
#import <AudioToolbox/AudioToolbox.h> | |
#import <AudioUnit/AudioUnit.h> |
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://devstreaming.apple.com/videos/wwdc/2016/102w0bsn0ge83qfv7za/102/102_platforms_state_of_the_union.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/201h1g4asm31ti2l9n1/201/201_internationalization_best_practices.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/202w2zhc4l8yomptqnt/202/202_whats_new_in_accessibility.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/203x2w42att1kdzg1ce/203/203_whats_new_in_cocoa.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/204t23fvanrkj7a1oj7/204/204_imessage_apps_and_stickers_part_1.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/205n2okotvilcayc8rc/205/205_whats_new_in_cocoa_touch.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/206a38wgme6uponcuwd/206/206_whats_new_in_tvos.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/207i37356qcyyh2yxos/207/207_whats_new_in_foundation_for_swift.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/208j30f4v1a1i9i5fg9/208/208_whats_new_in_watchos_3.pdf | |
http://devstreaming.apple.com/videos/wwdc/2016/209e37d5ks3pfj21ij5/2 |
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
/* | |
NSDictionary* parseRIFF(NSString* path) | |
parse RIFF file | |
General output dictionary | |
{ | |
formType = { | |
chunkId = ... ; |
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
- (NSString*)jsonStructureFromManagedObjects:(NSArray*)managedObjects; | |
- (NSArray*)managedObjectsFromJSONStructure:(NSString*)json withManagedObjectContext:(NSManagedObjectContext*)moc; | |
- (NSDictionary*)dataStructureFromManagedObject:(NSManagedObject*)managedObject | |
{ | |
NSDictionary *attributesByName = [[managedObject entity] attributesByName]; | |
NSDictionary *relationshipsByName = [[managedObject entity] relationshipsByName]; | |
NSMutableDictionary *valuesDictionary = [[managedObject dictionaryWithValuesForKeys:[attributesByName allKeys]] mutableCopy]; | |
[valuesDictionary setObject:[[managedObject entity] name] forKey:@"ManagedObjectName"]; | |
for (NSString *relationshipName in [relationshipsByName allKeys]) { |
NewerOlder