Post

Replies

Boosts

Views

Activity

Reply to How to get the return of XCTest validation?
There are a few ways you may be able to achieve this: Individual Test Case For an individual test case, you could override the record(_ issue: XCTIssue) which will be called for any assertion failures and should include its contextual information. For example: class MyCustomTests: XCTestCase {     // MARK: - Tests     func testExample() throws {         XCTAssertTrue(false, "some failing assertion")         XCTAssertEqual("A", "B", "another failing assertion")     }     // MARK: - Overrides     override func record(_ issue: XCTIssue) {         // process issues ...         super.record(issue)     } } References: https://developer.apple.com/documentation/xctest/xctestcase/3546549-record https://developer.apple.com/videos/play/wwdc2020/10687/ XCTestObservation A more flexible approach that could scale to multiple test cases would be to leverage XCTestObservation to observe all tests including occurrences of issues. For example: class MyTestObserver: NSObject, XCTestObservation {     func testCase(_ testCase: XCTestCase, didRecord issue: XCTIssue) {         // process issue ...     } } To get this wired up in a test bundle you could define a principle class (via setting NSPrincipleClass in the Info plist) which would orchestrate the observation. <key>NSPrincipalClass</key> <string>MyCustomTestsManager</string> @objc(MyCustomTestsManager) class MyCustomTestsManager: NSObject {     private let observer = MyTestObserver()     override init() {         super.init()         XCTestObservationCenter.shared.addTestObserver(observer)     } } References: https://developer.apple.com/documentation/xctest/xctestobservation https://developer.apple.com/documentation/xctest/xctestobservationcenter
Jun ’21
Reply to How to remove new List padding that appeared on iOS14?
I believe you can control this via explicitly specifying a plain list style Example: var body: some View { &#9;&#9;&#9;&#9;NavigationView { &#9;&#9;&#9;&#9;&#9;&#9;VStack(alignment: .leading) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;List { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;// ... &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;}.listStyle(PlainListStyle()) &#9;&#9;&#9;&#9;&#9;&#9;}.navigationBarTitle(Text("settings.title"), displayMode: .inline) &#9;&#9;&#9; } }
Oct ’20
Reply to Can an app have multiple widget extensions?
I was able to get multiple widget extensions working (the docs do mention that is supported), they all appear in the same location in the widget picker (e.g. like the Stocks widget has a 4th page with the Symbol widget). I did notice a small caveat though, you can either have multiple single widget extensions, or one extension with a WidgetBundle. In the case there are multiple extensions and one of them defines a WidgetBundle, you'll only see widgets from one of the extensions. I wonder if this behaviour is by design.
Jun ’20