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
// Force to show a titlebar icon | |
[window setRepresentedURL:[NSURL URLWithString:@"WindowTitle"]]; | |
// Set our custom icon | |
[[window standardWindowButton:NSWindowDocumentIconButton] setImage:[NSImage imageNamed:@"imagename"]]; | |
... | |
// Implement window delegate method to prevent to popup document (which do not exist) path menu when cmd+clicked | |
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu | |
{ |
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
// | |
// MTSegmentedControl.h | |
// | |
// Created by Michal Tomlein on 14/08/15. | |
// Copyright (c) 2015 Michal Tomlein. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> | |
@class MTSegmentedControl; |
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://stackoverflow.com/a/40089462 | |
extension Data { | |
func hexEncodedString() -> String { | |
return map { String(format: "%02hhx", $0) }.joined() | |
} | |
} |
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 Cocoa | |
let path = "/Users/You/Pick/Any/Random/File/On/Your/System.txt" | |
let destination = URL(fileURLWithPath: path) | |
let progress: Progress = { | |
let p = Progress(parent: nil, userInfo: [ | |
.fileOperationKindKey: Progress.FileOperationKind.downloading, | |
.fileURLKey: destination, | |
]) |
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 | |
extension Character { | |
/// A simple emoji is one scalar and presented to the user as an Emoji | |
var isSimpleEmoji: Bool { | |
return unicodeScalars.count == 1 && unicodeScalars.first?.properties.isEmojiPresentation ?? false | |
} | |
/// Checks if the scalars will be merged into and emoji | |
var isCombinedIntoEmoji: Bool { |
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
func snake2camel(string:String)->String: | |
var result = PoolStringArray() | |
var prev_is_underscore = false | |
for ch in string: | |
if ch=='_': | |
prev_is_underscore = true | |
else: | |
if prev_is_underscore: | |
result.append(ch.to_upper()) |
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
// | |
// Created by Chiharu Nameki @Ridwy on 2021/07/30. | |
// | |
import UIKit | |
import AVFoundation | |
/* | |
Using MTAudioProcessingTap, you can touch raw audio samples playing with AVPlayer. | |
This sample code shows how to use MTAudioProcessingTap in Swift 5. |
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 MyValue: _ViewTraitKey { | |
static var defaultValue: Int = 0 | |
} | |
extension View { | |
func myValue(_ value: Int) -> some View { | |
_trait(MyValue.self, value) | |
} |
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
// | |
// InfiniteScrollChart.swift | |
// ChartsGallery | |
// | |
// Created by beader on 2022/11/3. | |
// | |
import SwiftUI | |
import Charts |