How: Testing performance of IBDesignable

How do I go about testing the performance using measure or alike of various IBDesignable designed to accomplish the same task?

customUILabel vs. UILablelExtension

I am currently changing the class of the label for every run and testing via

import XCTest

class ALUIPerformanceTests: XCTestCase {
    let app = XCUIApplication()
    
    override func setUp() {
        continueAfterFailure = false
        app.launch()
    }

    func testPerformanceMeasureMetrics() {
        guard app.otherElements["welcome_view"].exists else { return }
        
        measure {
            let welcomeDescriptionLabel = app.staticTexts["welcome_desc"]
            XCTAssertTrue(welcomeDescriptionLabel.exists)
        }
    }
}

But the above with one case doesn’t help me much as it is 20% better during few runs and 35% worse during others . . .

@lganti Do you still have issues with this?

Not really, thanks for checking! : )

Hi @lganti,
Do you create custom components? This was a great craze that started with Xcode 6 when they were introduced, however it is not used as much unless you create custom components that other users can customize using the inspector in storyboards.

cheers,

It was for localization with XIBs

@IBDesignable for localisation? You want to visually preview the strings?

You might want to consider autolayout to adapt for short or longer strings, I guess if this resolves your issue, then good.

cheers,

1 Like

My bad - I didn’t word it properly. It was associated with two different methods taken to add the ability to add localized text with in a view’s XIB for instance . . .

This topic was automatically closed after 166 days. New replies are no longer allowed.