Skip to content

Make ViewController open#544

Draft
tomaszpieczykolan wants to merge 9 commits into
compnerd:mainfrom
tomaszpieczykolan:open_viewcontroller
Draft

Make ViewController open#544
tomaszpieczykolan wants to merge 9 commits into
compnerd:mainfrom
tomaszpieczykolan:open_viewcontroller

Conversation

@tomaszpieczykolan
Copy link
Copy Markdown
Contributor

This PR makes the ViewController class open, so that it can be overriden.

@tomaszpieczykolan
Copy link
Copy Markdown
Contributor Author

This is work in progress. Before submitting for review, I would like to audit the whole ViewController class and write some more unit tests for it.

Comment thread Tests/UICoreTests/ViewControllerTests.swift
@tomaszpieczykolan tomaszpieczykolan force-pushed the open_viewcontroller branch 3 times, most recently from 36588b9 to 90b3e9f Compare May 18, 2021 20:29
Comment thread Tests/UICoreTests/ViewControllerTests.swift
Comment thread Tests/UICoreTests/ViewControllerTests.swift Outdated
func testTitleGetterAndSetter() {
let sut = ViewController()

// XCTAssertNil(sut.title) // This is currently failing, but the initial value of `title` should be `nil`
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting, this sounds like you've found a bug!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this bug be fixed outside the scope of this PR, and can we mark this discussion as resolved?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems reasonable. Please write the test with the correct expectation; I'll add a utility to help mark the test as expected to fail.

Comment thread Tests/UICoreTests/ViewControllerTests.swift Outdated
Comment thread Tests/UICoreTests/ViewControllerTests.swift Outdated
Comment thread Tests/UICoreTests/ViewControllerTests.swift
Comment thread Tests/UICoreTests/ViewControllerTests.swift Outdated
Comment thread Tests/UICoreTests/ViewControllerTests.swift Outdated
@tomaszpieczykolan tomaszpieczykolan force-pushed the open_viewcontroller branch 2 times, most recently from 356c6f2 to eaf7550 Compare May 22, 2021 17:21
@compnerd
Copy link
Copy Markdown
Owner

@tomaszpieczykolan would you mind rebasing the change? I think that the new features that I've enabled will be nice to take advantage of.

@egorzhdan
Copy link
Copy Markdown
Contributor

The ability to subclass ViewController & override buildMenu(with: MenuBuilder) is really helpful for menus, it would be great to merge this PR if there is no concern left.

@compnerd
Copy link
Copy Markdown
Owner

compnerd commented Jul 3, 2021

I that that when the class is being marked open, we need to ensure that the members are properly marked as open as well, which is not the case yet. Furthermore, @tomaszpieczykolan has this marked as a draft still. I definitely am waiting on this change as I have some changes sitting around that require this to be open.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.98%. Comparing base (fda786e) to head (6b9c15d).
⚠️ Report is 183 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #544      +/-   ##
==========================================
+ Coverage   13.79%   14.98%   +1.19%     
==========================================
  Files         111      111              
  Lines        4443     4443              
==========================================
+ Hits          613      666      +53     
+ Misses       3830     3777      -53     
Files with missing lines Coverage Δ
...s/SwiftWin32/View Controllers/ViewController.swift 46.75% <ø> (+46.75%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants