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
// clang -framework Foundation -c properties.m | |
#import <Foundation/Foundation.h> | |
@interface PropertyBug : NSObject { | |
NSString* _value; | |
} | |
@property (copy) NSString* 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
// clang -arch armv7 -framework Foundation -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -S arm-test.m -o armv7-test.s | |
#import <Foundation/Foundation.h> | |
int main(const int argc, const char* const* argv) { | |
@autoreleasepool { | |
NSString* string; | |
string = @"hello"; | |
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
return ( | |
<MultiChildComponent> | |
<ChildNode key="child1"> | |
<span>Yo</span> | |
</ChildNode> | |
<ChildNode key="child2"> | |
<span>Dawg</span> | |
</ChildNode> | |
</MultiChildComponent> | |
); |
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 testCurrentYearAppearsInInfoPlistCopyright() throws { | |
let bundle = Bundle(for: AppDelegate.self) | |
let plist = try XCTUnwrap(bundle.localizedInfoDictionary) | |
let string = try XCTUnwrap(plist["NSHumanReadableCopyright"] as? String) | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy" |
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 Sequence { | |
func asyncMap<T>(_ transform: @escaping (Element) async -> T) async -> [T] { | |
return await withTaskGroup(of: T.self) { group in | |
var transformedElements = [T]() | |
for element in self { | |
group.addTask { | |
return await transform(element) | |
} | |
} |
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 NonSendable { | |
} | |
@available(*, unavailable) | |
extension NonSendable: Sendable { | |
} | |
actor MyActor { | |
let nonSendable: NonSendable |
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 AppKit | |
// Make a wrapper for the delegate that maps delegate methods to functions | |
// (Making it a class/inherit from NSObject as needed) | |
final class TextLayoutManagerDelegateAdapter: NSObject { | |
public typealias TextLayoutFragmentProvider = (_ location: NSTextLocation, _ textElement: NSTextElement) -> NSTextLayoutFragment | |
public let textLayoutFragmentProvider: TextLayoutFragmentProvider | |
public init( |
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
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
-1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
+1. Redistributions of source code must retain the above copyright notice, this list of conditions, a reference to the original project, and the following disclaimer. | |
-2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, a reference to the original project, and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products deri |
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
@MainActor | |
final class UsesAsyncSequence { | |
func original() { | |
let stream = AsyncStream { 42 } | |
Task { | |
// Passing argument of non-sendable type | |
// 'inout AsyncStream<Int>.Iterator' outside of main | |
// actor-isolated context may introduce data races | |
for await value in stream { |
OlderNewer