- Plain Strings (207):
foo
- Anchors (208):
k$
- Ranges (202):
^[a-f]*$
- Backrefs (201):
(...).*\1
- Abba (169):
^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
- A man, a plan (177):
^(.)[^p].*\1$
- Prime (286):
^(?!(..+)\1+$)
- Four (199):
(.)(.\1){3}
- Order (198):
^[^o].....?$
- Triples (507):
(^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
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
// | |
// JAZMusician.h | |
// JazzyApp | |
// | |
#import <Foundation/Foundation.h> | |
/** | |
JAZMusician models, you guessed it... Jazz Musicians! | |
From Ellington to Marsalis, this class has you covered. |
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
NSInternalInconsistencyException: Call must be made on main thread | |
0 CoreFoundation 0x196c40cb4 __exceptionPreprocess + 164 (NSException.m:202) | |
1 libobjc.A.dylib 0x18fcd83d0 objc_exception_throw + 60 (objc-exception.mm:356) | |
2 Foundation 0x1913ce54c -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 188 (NSException.m:242) | |
3 UIKitCore 0x1999f3da0 -[UIApplication _performBlockAfterCATransactionCommitSynchronizes:] + 404 (UIApplication.m:3377) | |
4 UIKitCore 0x199a00318 -[UIApplication _updateStateRestorationArchiveForBackgroundEvent:saveState:exitIfCouldNotRestoreState:updateSnapshot:windowScene:] + 528 (UIApplication.m:11822) | |
5 UIKitCore 0x199a005dc -[UIApplication _updateSnapshotAndStateRestorationWithAction:windowScene:] + 144 (UIApplication.m:11867) | |
6 <REDACTED> 0x104bbbc04 @objc closure #1 in <REDACTED>.userNotificationCenter(_: |
When a LazyVStack is nested within a ScrollView on iOS 17, the scroll view's content offset can be incorrectly set for a brief moment, causing the scroll view to "jitter".
Here's some sample code:
import SwiftUI
struct ContentView: View {
@State var isExpanded = Set<Int>()
var body: some View {
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
import AppKit | |
import Compression | |
import CoreImage | |
import Foundation | |
import Vision | |
// MARK: - Get QR code image from specified path | |
guard CommandLine.arguments.count == 2 else { | |
print("Usage: scan-shc [path-to-qr-image]") |
This gist documents the steps to analyze the binary size allocation for SwiftLint (and other SwiftPM-based executables).
First, install Bloaty McBloatface: https://github.com/google/bloaty
Then run the following:
$ swift build -c release
$ ditto .build/release/swiftlint swiftlint-stripped
$ strip -rSTX swiftlint-stripped
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
extension Array { | |
func parallelMap<T>(transform: (Element) -> T) -> [T] { | |
var result = ContiguousArray<T?>(repeating: nil, count: count) | |
return result.withUnsafeMutableBufferPointer { buffer in | |
DispatchQueue.concurrentPerform(iterations: buffer.count) { idx in | |
buffer[idx] = transform(self[idx]) | |
} | |
return buffer.map { $0! } | |
} | |
} |
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
//////////////////////////////////////////////// | |
// | |
// Swift and Objective-C Class Parsing | |
// | |
//////////////////////////////////////////////// | |
import Foundation | |
// Class parsing |
With the following code:
import SwiftUI
struct ContentView: View {
@State private var showPopover = false
var body: some View {
NavigationView {
An Xcode project generates the following archive:
$ tree Yams-macosx.xcarchive
Yams-macosx.xcarchive
├── Info.plist
├── Products
│ └── Library
│ └── Frameworks
│ └── Yams.framework
NewerOlder