Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to newer syntax per the Swift errors I was getting #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/Dispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private class pthreadBlock {
}

private func pthreadRunner( arg: UnsafeMutablePointer<Void> ) -> UnsafeMutablePointer<Void> {
let unmanaged = Unmanaged<pthreadBlock>.fromOpaque( COpaquePointer( arg ) )
let unmanaged = Unmanaged<pthreadBlock>.fromOpaque( OpaquePointer( arg ) )
unmanaged.takeUnretainedValue().block()
unmanaged.release()
return arg
Expand Down Expand Up @@ -73,7 +73,7 @@ public func dispatch_time( now: dispatch_time_t, _ nsec: Int64 ) -> dispatch_tim
}

public func dispatch_after( delay: dispatch_time_t, _ queue: dispatch_queue_t, _ block: dispatch_block_t ) {
dispatch_async( queue, {
dispatch_async( queue: queue, {
sleep( UInt32(Int(delay)/NSEC_PER_SEC) )
block()
} )
Expand Down
6 changes: 3 additions & 3 deletions Sources/NSString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public extension String {
*/

public func stringByReplacingOccurrencesOfString( str1: String, withString str2: String ) -> String {
return componentsSeparatedByString( str1 ).joinWithSeparator( str2 )
return componentsSeparatedByString( str1 ).joined(separator: str2 )
}

public func rangeOfString( str: String ) -> Range<Int>? {
Expand All @@ -116,15 +116,15 @@ public extension String {
withCString { (bytes) in
let bytes = UnsafeMutablePointer<Int8>(bytes)
bytes[index] = 0
out = String.fromCString( bytes )!
out = String(bytes)
}
return out
}

public func substringFromIndex( index: Int ) -> String {
var out = self
withCString { (bytes) in
out = String.fromCString( bytes+index )!
out = String( bytes+index )
}
return out
}
Expand Down