Skip to content

Commit

Permalink
Fixed obj-c compatibility utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkenso committed Nov 20, 2021
1 parent fff53f6 commit 8ad3289
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/SwiftConvenienceObjC/SwiftConvenienceObjC.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@implementation NSException (SwiftConvenience)

+ (nullable instancetype)sc_catching:(void(NS_NOESCAPE ^)(void))block
+ (nullable instancetype)scbridge_catching:(void(NS_NOESCAPE ^)(void))block
{
@try
{
Expand All @@ -49,7 +49,7 @@ @implementation NSXPCConnection (SwiftConvenience)

- (audit_token_t)scbridge_auditToken
{
self.auditToken;
return self.auditToken;
}

@end
20 changes: 20 additions & 0 deletions Tests/SwiftConvenienceTests/ObjCTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// File.swift
//
//
// Created by Alkenso (Vladimir Vashurkin) on 20.11.2021.
//

import SwiftConvenience
import XCTest


class ObjCTests: XCTestCase {
func test_catchNSException() throws {
let exception = NSException.catching {
NSException(name: .genericException, reason: "Just", userInfo: nil).raise()
}
XCTAssertEqual(exception?.name, .genericException)
XCTAssertEqual(exception?.reason, "Just")
}
}

0 comments on commit 8ad3289

Please sign in to comment.