Author: Chris Lattner
public struct BoundedSequence<Base>: Sequence, IteratorProtocol where Base: Sequence { | |
public struct Boundary: Equatable { | |
public let isStart: Bool | |
public let isEnd: Bool | |
} | |
private var _iterator: Base.Iterator | |
private var _previous: Base.Element? | |
private var _current: Base.Element? | |
private var _next: Base.Element? |
#import <Foundation/Foundation.h> | |
#import "ffi.h" | |
NSMutableArray *g_allocations; | |
ffi_cif g_cif; | |
ffi_closure *g_closure; | |
void *g_replacement_invoke; | |
void *g_origin_invoke; |
import Darwin | |
@dynamicMemberLookup | |
struct Environment { | |
subscript(dynamicMember name: String) -> String? { | |
get { | |
guard let value = getenv(name) else { return nil } | |
return String(validatingUTF8: value) | |
} |
- Proposal: SE-XXXX
- Authors: Chris Lattner, Joe Groff
Modern Cocoa development involves a lot of asynchronous programming using closures and completion handlers, but these APIs are hard to use. This gets particularly problematic when many asynchronous operations are used, error handling is required, or control flow between asynchronous calls gets complicated. This proposal describes a language extension to make this a lot more natural and less error prone.
This paper introduces a first class Coroutine model to Swift. Functions can opt into to being async, allowing the programmer to compose complex logic involving asynchronous operations, leaving the compiler in charge of producing the necessary closures and state machines to implement that logic.
var status: OSStatus | |
let readOrWrite = kAudioFileGlobalInfo_ReadableTypes | |
var propertySize: UInt32 = 0 | |
status = AudioFileGetGlobalInfoSize(readOrWrite, | |
0, | |
nil, | |
&propertySize) | |
print(status) | |
print(propertySize) | |
xcodebuild -workspace XXX.xcworkspace -scheme XXX clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep '^\d\{3,\}[.]\{1\}' |
# Raw command | |
BACKUP=$(tmutil latestbackup) ; if [ "$(cat ~/.lastbackup 2>/dev/null)" != "$BACKUP" ]; then echo $BACKUP > ~/.lastbackup ; osascript -e "display notification \"$(echo $BACKUP | xargs basename)\" with title \"Backup finished\""; fi | |
# As cron entry | |
*/5 * * * * BACKUP=$(tmutil latestbackup 2>/dev/null) ; if [ "$(cat ~/.lastbackup 2>/dev/null)" != "$BACKUP" ]; then echo $BACKUP > ~/.lastbackup ; osascript -e "display notification \"$(echo $BACKUP | xargs basename)\" with title \"Backup finished\""; fi 2>&1 >/dev/null |
New Feature
- 205 getting started with multitasking on ipad in iOS 9 😀
- 211 multitasking essentials for mediabased apps on ipad in iOS 9 😀
- 212 optimizing your app for multitasking on ipad in iOS 9 😀
- 509 seamless linking to your app 😀
- 709 introducing search apis 😀
Foundation & Core Frameworks(UIKit etc.)
import Foundation | |
public func getASTString() -> String { | |
// get the file path for the file "test.json" in the playground bundle | |
// let filePath = NSBundle.mainBundle().pathForResource("FirstTtest", ofType: "ast") | |
// get the contentData | |
let contentData = NSFileManager.defaultManager().contentsAtPath("a.txt") | |