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 3 years ago.
Improve this question
I've been told during a job assignment review, that I used weird filenames in my iOS project.
I've added a picture of my project tree. Could you explain me what's weird about these names or if there are any flaws in the tree structure?
Thanks
"Weirdness" is a subjective term and it isn't one that I would use to give feedback to someone in a review.
There is nothing "weird" about the names you have chosen. Perhaps the interviewer was unable to immediately ascertain what "Launches.swift" contained?
Are you able to ask the reviewer for more information about what they perceived as weird? It would be nice to understand more about their opinion.
In general, the name of a source file best describes the primary
entity that it contains. A file that primarily contains a single type
has the name of that type. A file that extends an existing type with
protocol conformance is named with a combination of the type name and
the protocol name, joined with a plus (+) sign. For more complex
situations, exercise your best judgment.
source: https://google.github.io/swift/#file-names
For example:
MasterViewController -> LibraryMasterViewController
MasterPresenter -> BooksPresenter etc
Related
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 new to Swift development and wanted to ask a question related to Swift files.
If I am making a project is it a good or general practice to use only one struct or class in one file? Do you need to create a different .swift file for every new struct or class ?
It's common to make a new file per type (struct/class/enum) with the file named for the type, but there are exceptions to the rule. If the type definition is small, and closely related to some other type, then it can be easier to read if it's in the same file with the other type definition - that's quite common with enums. Or if the type is nested in an enclosing type, then it's often written inline. But this is a matter of personal preference.
It's not necessary. But create a different .swift file for every new struct or class help you more easy to maintain source code when your codebase is large
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
For testing, I needed to generate a list of data values randomly and put them into the models for further use. But I found out that there is no library, which could produce such functionality.
The elegant solution I expected to find had to combine such simple things as:
the variety of data;
the variety of methods to reach this data;
the possibility to change the default data set to the custom one.
Since I hadn't found the accurate solution, I decided to create my own library (ref. https://github.com/codeitua/ios-data-factory).
There were implemented all necessary methods for data generation (including random names, cities, addresses, dates etc) and data retrieve. And moreover, it has "swifty" interface, which provides comfortable use in every project.
I hope, it will be helpful for everyone, who faced the same problem as me!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm currently working on an app that needs to communicate with a secure system. I need to generate a public and private key according to a couple of requirements. According to system specs, the key derivation iterations is required to be set to 1000, but I can't find any way to do this on iOS.
Can anyone help me out? Thanks!
As stated in comment, your question is a bit too broad. I am guessing that you are asking about PBKDF2.
You can use CommonCrypto to do that. I used it with Objective-C and it was relatively easy. I think there might be some difficulties to use it with Swift, but Google search has a lot of info how to do that.
You will need to use CommonCrypto function CCKeyDerivationPBKDF - link to docs. There is a round parameter which I think is what you are looking for.
This question might help too.
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 8 years ago.
Improve this question
The question is about structuring in iOS
So I receive a message from a company where I passed a test and they say:
"First of all I want to highlight that they said (developers who took my test) that they really liked how clean your code was. One thing where you could improve is the structuring of classes which wasn't ideal."
I asked about what actually I did wrong or what should I improve. I am not sure that this is the stack question, but maybe some one can point me or suggest some thing how for example you structure you code.
I am asking because clean and structure and what about I care every time, but right now I hear that is not ideal.
So usually I write code with the count of lines no more then 250 - 300. I care about pragma marks that separate code into lifecycle blocks, i care about spaces and etc.
So my code is separated also into "folders" where I store appropriate logic elements like:
View Controllers
Views
Constants
Models
Helpers
XIBs (if any)
Storyboards (if any)
Each of these folders have subfolders that is not a group as well but real folder on hard drive and each folder contain some classes which named with appropriate name the class does.
I understand there are no rights or examples how to structures project, because it depend on the tasks and developers or company style. But if I receive some message like above, so then maybe can someone suggest something where I can read about or what I miss maybe.
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 8 years ago.
Improve this question
MVC5 identity stores userId in a string, but WHY?
If you don't feel like answering THE question you can just post random links how to store user id'z as int's...
Well, you seem to be quite rude for someone who is quite wrong.
ASP.NET Identity does NOT use strings for Id, it just uses strings for Id by default in the template generated by visual studio for a "starter project". You can use whatever you want for Id by defining a new IdentityUser type. Just like you aren't stuck with using the supplied templates for your views, or controllers, or anything else.
See https://stackoverflow.com/a/23573049/61164
The reason it uses strings is because the default identity type in the starter project template is a Guid, which not all database types support (remember, it supports more than just SQL Server). So, it uses strings to store them for compatibility reasons.
Well I guess it uses a different scheme for Id
If you will check your Database, a sample Id Looks like this
"62e41fbc-dbd6-41d2-8209-0fdf29fb1908"
Assuming this is hash or encrypted value.
If you want to store them as integer or make a Id Count, you can just add another entry to the table (ASPUserId) then make it an int then increment every time you make an entry