Skip to content

Fix the bugs of setting view and change to swift lifecycle - #148

Closed
underthestars-zhy wants to merge 8 commits into
CodeEditApp:mainfrom
underthestars-zhy:main
Closed

underthestars-zhy wants to merge 8 commits into
CodeEditApp:mainfrom
underthestars-zhy:main

Conversation

@underthestars-zhy

@underthestars-zhy underthestars-zhy commented Mar 21, 2022 •

Copy link
Copy Markdown

Description

  1. Fix the problem that doesn't show icon on Setting View Tab bar2.
  2. Change to the SwiftUI life cycle without any devastating problem
  3. Change the picker style so it now mathes the Xcode picker version.

Releated Issue

#146

Screenshots (if appropriate):

CleanShot 2022-03-21 at 19 14 45@2x

@lukepistrol
lukepistrol marked this pull request as draft March 21, 2022 11:25
@lukepistrol
lukepistrol requested a review from pkasila March 21, 2022 11:25

@lukepistrol lukepistrol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The system status bar is gone now (see screenshot)

also make sure to resolve SwiftLint warnings as stated in contribution guidelines.

Screen Shot 2022-03-21 at 12 34 26

And also don't include a Team ID on commits

Comment thread CodeEdit.xcodeproj/project.pbxproj Outdated
Comment thread CodeEdit.xcodeproj/project.pbxproj Outdated
Comment thread CodeEdit.xcodeproj/project.pbxproj Outdated
Comment thread CodeEdit.xcodeproj/project.pbxproj Outdated
Comment thread CodeEdit/AppDelegate.swift Outdated
@lukepistrol lukepistrol linked an issue Mar 21, 2022 that may be closed by this pull request
@underthestars-zhy
underthestars-zhy marked this pull request as ready for review March 21, 2022 12:12
@underthestars-zhy

Copy link
Copy Markdown
Author

Fixed the problem that menus doesn't show

@lukepistrol lukepistrol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Preferences is grayed out and ⌘+, doesn't work

Screen Shot 2022-03-21 at 13 11 42

And Dev Team ID still not removed.

Also 21 swiftlint warnings

@lukepistrol
lukepistrol marked this pull request as draft March 21, 2022 12:18

@lukepistrol lukepistrol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • Status bar is still missing items

Screen Shot 2022-03-21 at 13 53 41

  • Settings Window not closing with ⌘ + W

@pkasila

pkasila commented Mar 21, 2022 •

Copy link
Copy Markdown
Member

In this way you can both use swiftui app methods and appkit AppDelegate.

At the very beginning of the project, I made transition from SwiftUI lifecycle to AppKit's AppDelegate. This transition was made because SwiftUI doesn't have some features that same old AppKit has.

Also, we are using AppKit's way (via NSDocuments) to handle all documents (workspaces and single files). I had made this decision to use NSDocument instead of SwiftUI's DocumentGroups, because DocumentGroup works with FileWrappers which are limited, for example, you cannot access file's URL using FileWrapper.

Mixing SwiftUI lifecycle and AppKit's AppDelegate wouldn't be easy. SwiftUI's NSApplicationDelegateAdaptor was added to SwiftUI to allow only handling NSApplicationDelegate notifications. And you cannot mix for example MainMenu.xib's menu and menu elements declared in SwiftUI (soon and later menu elements will be overwritten by SwiftUI, and it happens when you open Settings).

@underthestars-zhy

underthestars-zhy commented Mar 21, 2022 •

Copy link
Copy Markdown
Author

In this way you can both use swiftui app methods and appkit AppDelegate.

At the very beginning of the project, I made transition from SwiftUI lifecycle to AppKit's AppDelegate. This transition was made because SwiftUI doesn't have some features that same old AppKit has.

Also, we are using AppKit's way (via NSDocuments) to handle all documents (workspaces and single files). I had made this decision to use NSDocument instead of SwiftUI's DocumentGroups, because DocumentGroup works with FileWrappers which are limited, for example, you cannot access file's URL using FileWrapper.

Mixing SwiftUI lifecycle and AppKit's AppDelegate wouldn't be easy. SwiftUI's NSApplicationDelegateAdaptor was added to SwiftUI to allow only handling NSApplicationDelegate notifications. And you cannot mix for example MainMenu.xib's menu and menu elements declared in SwiftUI (soon and later menu elements will be overwritten by SwiftUI, and it happens when you open Settings).

This is a problem. But we can fix it. Also swiftui code is more readable.

@underthestars-zhy

Copy link
Copy Markdown
Author

Also I can use keyboard shortcut to close the window

@underthestars-zhy

Copy link
Copy Markdown
Author
CleanShot.2022-03-21.at.21.05.14.mp4

@underthestars-zhy
underthestars-zhy marked this pull request as ready for review March 21, 2022 13:06
@underthestars-zhy

Copy link
Copy Markdown
Author

CleanShot 2022-03-21 at 21 22 37@2x

I don't think I need to change this.

@lukepistrol

Copy link
Copy Markdown
Member

Since our workflow is treating warnings as errors (swiftlint --strict) you have to. Otherwise the workflow will fail. See contribution guide.

@lukepistrol

Copy link
Copy Markdown
Member

@pkasila will have a detailed look at it later today.

@lukepistrol
lukepistrol requested review from pkasila and removed request for lukepistrol and pkasila March 21, 2022 13:39
@underthestars-zhy

Copy link
Copy Markdown
Author

Since our workflow is treating warnings as errors (swiftlint --strict) you have to. Otherwise, the workflow will fail. See contribution guide.

But you can see the space in apple’s file

@lukepistrol

Copy link
Copy Markdown
Member

Look, we have rules and if you don't want to follow them you can file a new Issue where changes can be discussed. If your code does not pass the checks we cannot merge it as unmistakably stated in our contribution guidlines.

@lukepistrol
lukepistrol removed their request for review March 21, 2022 14:09
@austincondiff

Copy link
Copy Markdown
Collaborator
CleanShot 2022-03-21 at 21 22 37@2x

I don't think I need to change this.

I actually agree, a little whitespace once in a while is a good thing and makes the code more readable.

@0xWDG

0xWDG commented Mar 21, 2022

Copy link
Copy Markdown
Collaborator
CleanShot 2022-03-21 at 21 22 37@2x I don't think I need to change this.

I actually agree, a little whitespace once in a while is a good thing and makes the code more readable.

The newline is not a problem for swift lint, but the whitespace/tab indentation without code is the problem for swiftlint.

@pkasila pkasila left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use AppDelegate instead of mixing SwiftUI lifecycle and AppDelegate.

As I stated before, I don't think that mixing SwiftUI lifecycle with AppDelegate is good. The main problem is that Preferences tab can be implemented by using NSToolbar, window.toolbarStyle = .preference and NSTabViewController inside. Alternatively, it can be implemented by using Preferences package.

So, there is no need in mixing SwiftUI lifecycle and AppKit's way with AppDelegate. Especially, if we need make workarounds to make it work correctly like changing MainMenu after it has been changed by SwiftUI lifecycle.

@pkasila pkasila closed this Mar 21, 2022
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.

🐞 Setting view doesn't show the icon

5 participants