Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I faced with two declaration NSArray<MyProtocol> and NSDictionary<MyProtocol>. I didn't find correct explanation of it and how work correct with it.
I think this may be related to a clever macro that did the rounds recently (possibly this one, there are a lot of similar projects on GitHub).
The values stored by NSArray and NSDictionary are of type id. This basically means that the type of the objects being stored is untyped. The problem with this is a that you loose type safety. The macro in question attempted to address this problem by creating a protocol that is applied to the array/dictionary so that the returned objects have a more specific type than id.
In Xcode you can find where <MyProtocol> is being declared by cmd+clicking on it <MyProtocol>.
Personally I would avoid using such macros. They are solving a problem, but the solution is not in keeping with the Objective-C ethos. I would solve this problem by one or more of the following:
ensuring the collection has a descriptive instance/variable name
creating another class that wraps the collection.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Other than the fact that the compiler automatically generates certain functions for Data Class, what is the fundamental difference between them?
In Kotlin, classes declared with the data class keywords simply get some extra methods generated:
equals
hashcode
toString
copy
componentX
Declaring a regular class and defining these methods manually yields exactly the same thing. There is no other difference at bytecode level.
You do however have some extra limitations (no non-property constructor arguments, limitations on inheritance...), but these are just compile-time limitations so that the generated methods behave in a predictable/non surprising way.
The official doc covers everything in detail about them.
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
I don't know where to start with this. If there is a way, all I need is an object name or collection name, so I can look up the feature on Microsoft's site, and go from there. But, searching there directly didn't turn anything up.
You're probably looking for the VBE Extensibility Library.
However note that depending on what you're actually trying to do ("modify other VBA code"), it may be very hard, if not impossible to implement.
The library will let you iterate modules, locate their members, pull the actual code into strings (from entire modules or just a given procedure)... but that's as granular as it gets.
If you're trying to do anything that requires understanding of the code's semantics, the VBIDE API won't be enough: you need a lexer and a parser for that... and I've yet to see a successful lexer/parser for VBA, written in VBA.
Good luck!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I ended up with the following plus a few modifications:
NSArray *Quotes = #[#"test1",#"test2"];
NSString *Quoteselected = arc4random() % [quotes];
self.label.text = Quoteselected;
I found the error, which probably also caused the SIGARBT -my randomization created values bigger than what I had element for in the array - thereby making the code try to pick elements not existing.
thanks for all the help
I think this is what you look for:
http://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started
This is called core data that comes with Objective-C. It is what I use for small, LOCAL database.
On the other hand, for small to medium size of database for a starter like you (I presume you just started making programs?) Check out ruby on rails and AFNetworking library. BTW, this is ONLINE or REMOTE databse. (Just saying, but in ruby on rails, database can be created with using command line, you'll know how simple it is)
http://guides.rubyonrails.org/getting_started.html
Two options, you can choose either one.
Assuming you're okay with typing out every quote, you could use a property list
plist tutorial
Unless it's a very large database
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 9 years ago.
Improve this question
I am fairly new to Objective C and wonder if most people remove or don't remove unused methods. For example, when I create a UIViewController, there are stub methods that I often don't use, and I want to remove them.
You can remove them if you'd like. However, if you leave them in, make sure a call to super is performed in each method so that you don't lose the default implementation. This means you want your empty (for now) method to extend, not override, the functionality of that same method in parent class.
Edit: Having a method implementation that does nothing other than call the same method on super is equivalent to removing the method all together. Super will then be called by default.
I remove them along with all dead code. They just clutter the working code and reduce readability.
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 9 years ago.
Improve this question
The question says it all really.
What are the differences between these two methods that appear to carry out exactly the same function?
Is there guidance to say which should be used or are there conditions when you may use either?
The FileSystem.MoveFile has some more options than File.Move, like for example optionally showing a progress dialog, and creating the destination folder if it doesn't exist.
If you just want to move or rename a file, the File.Move method will be called in the end whichever you use, so calling it directly means slightly less overhead.
I believe they have near-identical functionality. Most people I've seen would prefer to use the latter, because "MyComputer." is a VB.NET-only construct, whereas File.Move is used in both C# and VB.NET. This makes it easier to get help, and easier for C# coders to read the VB.NET code and vice-versa.
I haven't checked My.Computer.FileSystem.MoveFile, but you can state if they are differences moving html files with associated images directories., because File.Move just move the file, but doesn't move the associated directory