Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am starting a new project today from scratch using Swift and MVVM architecture.
I would like to setup the files & folders structure for the best practice I can for easy and understandable navigation and usage.
Most tutorials suggest:
├─ Models
├─ Views
├─ ViewModels
├─ Stores
├─ Helpers
But I find it very lacking as I don't really know what would be the best practice to manage the ViewModels folder.
Any good suggestions from real world super maintainable projects?
Thanks a lot! :)
According to uncle Bob's Clean Architecture pattern, you may divide your code in 3 Layers :
Presentation : All Code which is Framework ( Cocoa here ) dependant. So Put your Views, ViewModels, Vierwcontrollers, etc.
Data : All the code interacting with repositories ( Like Network Calls, DB calls, User Defaults, etc )
Domain : All your Models
The view files will create data bindings that are implemented as escaping/nonescaping closures in the view model to update ui labels and such when view model variables are updated.
I am unsure how to organize the view folder though since Xcode basically forces you to make view controller files.
├─ Model
|-|Employee
|-|Customer
|
├─ View
├─ ViewModel
|-|EmployeeViewModel
|-|CustomerViewModel
|
├─ Utilities
|-|NetworkManagerSingleton
YourProject
│
│ Info.plist
|
├─── Model
│ UserModel.swift
│ ProductModel.swift
│ CartModel.swift
│
├─── View
│ Main.storyboard
│ LaunchScreen.storyboard
│ ProductCell.xib
│
├─── Controller
│ HomeVC.swift
│ ProductsVC.swift
│ CartVC.swift
│
├─── Utilities
│ │
│ └─── Extensions
│ UIViewController+Additions.swift
│ String+Additions.swift
│ Dictionary+Additions.swift
│ UIView+Additions.swift
│
├──── Helpers
│ │ CommonMethods.swift
│ │
│ └─── Constants
│ AppMessages.swift
│ Keys.swift
│ EndPoints.swift
├──── Services
│ APIManager.swift
│ Services.swift
│
Related
If I have a main layout "+layout.svelte" at /routes and then try to reset the layout at /routes/auth/login It is not working.
If the name is "+layout.svelte" the layout is embedding inside the main layout.
If the name is "+layout#.svelte" it's not working.
If the name is "+layout.reset.svelte" its: Error: Files prefixed with + are reserved.
Because the default configuration of svelte/kit is vite. I think they changed it, but I don't know how to do it.
Only thing I can find in the docs about resetting layouts.
At: kit.svelte.dev/docs/advanced-routing#advanced-layouts-layout
Stuff has happened in the world since the accepted answer was posted. This is also true for Svelte/kit. Now there is something called (group) that looks like this:
src/routes/
│ (app)/
│ ├ dashboard/
│ ├ item/
│ └ +layout.svelte
│ (marketing)/
│ ├ about/
│ ├ testimonials/
│ └ +layout.svelte
├ admin/
└ +layout.svelte
This lets you group layouts in directories that has its name wrapped in parenthesis (that don't affect the routing). Here a +layout.svelte file inside such a directory will add to the src/+layout.svelte file - this layout wraps all other layout files defined in grouped directories.
Once you wrap your head around it, it is very easy to use. Read more about it in the documentation for advanced routing / advanced layouts
you need to create login layout at routes as +layout-login.svelte and refer on login page as +page#login.svelte
If I have a project structured like this:
project
│ README.md
│ config.json
package.json
│
└───folder1
│ │ fileA.js
│ │ fileB.html
│
└───folder2
│ fileC.js
│ fileD.html
How can I add a rule to the CODEOWNERS file that gives a user ownership of only the files in the root folder, but not the files in any of the subdirectories?
I've tried the following but none of them seem to work the way I want:
# CODEOWNERS
/ #johnSmith
./ #johnSmith
/* #johnSmith
After some experimenting this seems to work:
#CODEOWNERS
/*.* #userName
/apps #differentUserName
That will give #userName ownership of root files. It also applies to files inside dot-prefix folders, like .github/ or .vscode/ but no other nested directories
How to disable this message:
┌───────────────────────────────────────────────────────────────────────────────────┐
│ Share your Cucumber Report with your team at https://reports.cucumber.io │
│ Activate publishing with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.enabled=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.enabled=true │
│ Environment variable: CUCUMBER_PUBLISH_ENABLED=true │
│ JUnit: #CucumberOptions(publish = true) │
│ │
│ More information at https://reports.cucumber.io/docs/cucumber-jvm │
│ │
│ Disable this message with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.quiet=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.quiet=true │
└───────────────────────────────────────────────────────────────────────────────────┘
What steps to take?
In the message it is saying as below:
Disable this message with one of the following:
src/test/resources/cucumber.properties: cucumber.publish.quiet=true
src/test/resources/junit-platform.properties: cucumber.publish.quiet=true
For me it was disabled after doing both of the above
create a new cucumber.properties file under rc/test/resources/ and then add this line
cucumber.publish.quiet:true
I've got the same problem here and I solved it by following the steps in the message:
Creating cucumber.properties and junit-platform.properties in "src/test/resources" on the Package Explorer;
Adding the line "cucumber.publish.quiet=true" to each one of them.
At times the resources folder might not be there by default on eclipse , then you would need to create a folder under src/test by the name 'resources' and the create 2 sub-folders under that folder named 'cucumber.properties' and 'junit-platform.properties' and add that declaration under both.
cucumber.publish.quiet=true
For disabling the cucumber publish message in console,reference for console Message.
Create a file named "cucumber.properties" in src/test/resources file path(which by default gets created when we create a new project in eclipse). Mention cucumber.publish.quite=true in the properties file. That's it now you won't see that cucumber content in the console.
reference image.
Currently I have 2 projects, both with the same structure: all source goes to folder src.
src
└───folder1
│ │ file011.js
│ │ file012.js
│ └───...
└───folder2
│ │ file021.js
│ └───file022.js
│
│ services.js
Somewhere deep down in src folder, I have
import { ClassA} from 'services';
where services is direct child file inside src folder.
In 1 project, opened with Code-Insiders, i get full intellisense on ClassA, but nothing in the other. Wonder what causes the different behavior between the 2 and how I can adjust that.
I guess I didn't upgrade the right way, but for a while I was running two versions of Perl concurrently. Now I just have one, but every time I start PPM it recreates the Perl folder of one of the old locations. I've set the active one to be the current Perl folder, but because the old one is still present on the list (displayed when I go Edit->Preferences), it creates it every time. How do I get it to stop doing that? I looked through the Windows Registry but I don't think that's where the areas are tracked.
This is ActiveState Perl 5.10.1 build 1006 on Windows Server 2003.
My new guess is that ppm is looking in Config.pm (which is generated at install time) for the locations. Again, if you use the correct ppm, it will pick up the correct paths.
This could be way off topic, but I had to move our group's Perl install from one network drive/server (W:) to another (Z:). I had lots of problems with the PPM site stuff too (mostly because I wanted to change to a non-standard "user" area) so I wrote everything down (in case I every had to do it again).
Hopefully, some of this is useful to Kev, or any others looking at this.
1) Install the latest ActivePerl distribution. In this case, it was 5.8.8 build 820. I installed this into Z:\Software\Perl\5.8.8, with the intention that Z:\Software\Perl\site\lib would be the “user” area for installing Packages, instead of the default Z:\Software\Perl\5.8.8\site\lib.
2) Set the new Perl “bin” dir to be first on my PATH and open up a DOS prompt. Type “ppm area” and you should see the following areas:
┌────────────┬──────┬─────────────────────────────────┐
│ name │ pkgs │ lib │
├────────────┼──────┼─────────────────────────────────┤
│ (Software) │ n/a │ Z:/Software/Perl/site/lib │
│ perl │ 0 │ Z:/Software/Perl/5.8.8/lib │
│ site* │ 0 │ Z:/Software/Perl/5.8.8/site/lib │
└────────────┴──────┴─────────────────────────────────┘
3) I needed to get “site” turned to “(site)” (read-only) and “(Software)” turned to the default, writable PPM Area. Also, I didn’t like the name “Software” (picked up from the beginning of the path on Z:, I assume), so I also wanted to rename it to “user”.
4) Run the full PPM GUI (type “ppm” in DOS) and set Software as the default Area (Edit -> Preferences) and install something easy (I usually pick MP3-Info).
5) Exit the GUI and run “ppm area” again to get:
┌──────────┬──────┬─────────────────────────────────┐
│ name │ pkgs │ lib │
├──────────┼──────┼─────────────────────────────────┤
│ Software │ 1 │ Z:/Software/Perl/site/lib │
│ perl │ 0 │ Z:/Software/Perl/5.8.8/lib │
│ site* │ 0 │ Z:/Software/Perl/5.8.8/site/lib │
└──────────┴──────┴─────────────────────────────────┘
6) For some reason, “ppm area” isn’t showing Software as the default Area, even though I did select it as the default inside PPM’s preference. Don’t worry about this yet.
7) Go to Z:\Software\Perl\site\lib\etc and rename the DB file to “ppm-user-area.db". Go to Z:\Software\Perl\5.8.8 and remove ALL write-permissions to the “site” folder and all sub-folders. Run “ppm area” again and you should see:
┌────────┬──────┬─────────────────────────────────┐
│ name │ pkgs │ lib │
├────────┼──────┼─────────────────────────────────┤
│ user* │ 1 │ Z:/Software/Perl/site/lib │
│ perl │ 42 │ Z:/Software/Perl/5.8.8/lib │
│ (site) │ 0 │ Z:/Software/Perl/5.8.8/site/lib │
└────────┴──────┴─────────────────────────────────┘
8) You should now be all set! You default PPM Area is “user” (Z:\Software\Perl\site\lib) and the “site” Area (Z:\Software\Perl\5.8.8\site\lib) is not writable (this is important because it’s not on Perl’s search path – if someone installed Packages in there, Perl wouldn’t be able to find them!).
I did have some problems getting PPM to recognize all the Packages intalled in the “perl” Area. It kept listing that Area as locked in the PPM GUI Preferences. Eventually, I deleted the PPM DB file in Z:\Software\Perl\5.8.8\etc and the PPM GUI could magically find everything!
Replace all references throughout .packlists (and possibly all other files under the Perl path as well), then delete the .db files in etc/ and site/etc, then run ppm to let it re-build the database based on the updated packlists.
So the answer is some combination of Config.pm, lib\Config_heavy.pl, lib\CORE\config.h, possibly other files, the .dbs, and the .packlists.
Although, who's to say if I had left the Windows Registry entries there too it wouldn't've found them?