Skip to content

Commit

Permalink
Fix a build error on linux: kCFStringEncodingUTF8 is not defined. (#…
Browse files Browse the repository at this point in the history
…173)

Instead, use `CFStringBuiltInEncodings.UTF8.rawValue`.

Also fix a type error I was getting in a unit test.

Co-authored-by: adaml <adam@seesaw.me>
  • Loading branch information
adamleonard and adamseesaw committed Jul 21, 2020
1 parent 8cf59d6 commit 0ca4c76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions Sources/OpenCombineFoundation/Timer+Publisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,17 @@ extension RunLoop.Mode {
return CFRunLoopMode(rawValue as CFString)
#else
return rawValue.withCString {
CFStringCreateWithCString(
nil,
$0,
CFStringEncoding(kCFStringEncodingUTF8)
)
#if swift(>=5.3)
let encoding = CFStringBuiltInEncodings.UTF8.rawValue
#else
let encoding = CFStringEncoding(kCFStringEncodingUTF8)
#endif // swift(>=5.3)

return CFStringCreateWithCString(
nil,
$0,
encoding
)
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/OpenCombineTests/PublisherTests/CollectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class CollectTests: XCTestCase {

func testtestUpstreamFinishesImmediately() {
ReduceTests.testUpstreamFinishesImmediately(expectedSubscription: "Collect",
expectedResult: [],
expectedResult: [Int](),
{ $0.collect() })
}

Expand Down

0 comments on commit 0ca4c76

Please sign in to comment.