Questions tagged [objective-c]
Objective-c is a highly dynamic message-based object-oriented language, superset of C, that is a primarily used for programming Apple's Mac OS X and iOS platforms.
194 questions
3
votes
3
answers
748
views
What is the best way to retain a local object which is performing an asynchronous task?
My problem is the following: inside a method I'm creating an object like this:
MyObject* myObject = [MyObject new];
Then I want it to perform an asynchronous task like this:
[myObject ...
1
vote
2
answers
872
views
How is it that reference counting is faster on Apple silicon Intel translation than on Intel?
I can't find the exact tweet, but it was stated by Apple engineers that the retain and release operations are faster on Intel x86 translation than on standard Intel x86.
1
vote
2
answers
269
views
Is NSNotification in iOS a good design?
Because of some essential C++ libraries, I have to mix Objective-C and C++ in my code. But the problem is that the callback between C and Objective-C is extremely hard to design and manipulate, so I ...
4
votes
3
answers
7k
views
Is it a good idea to use Singleton pattern for an API manager?
So basically I am writing a wrapper for a REST API in objective-c so that our customer can easily use them in their iOS development.
I am trying to find a good design pattern for this purpose, it ...
1
vote
1
answer
186
views
Objective-C: Strategy Pattern, is mainly by selector?
To use Strategy Pattern in Objective-C, I think it is mainly by selector.
To omit if...else, use Objective-C runtime, convert string matching to choose selector (Strategy).
Am my understanding ...
2
votes
0
answers
657
views
How to dispatch these functions in Objective C to not lock Main thread?
There's a large shared object (kind of OpenGL context) in my project.
It is accessed from multiple threads.
To ensure only one thread at the moments is using SHARED_OBJECT, mutex (kind of ...
1
vote
1
answer
56
views
MVC: In iOS how to pick a view and then apply a suitable controller to it?
Per MVC design pattern as in GOF, "a view can be disabled so that it doesn't accept input simply by giving it a controller that ignores input events". That means, we decide a view first and then pick ...
3
votes
3
answers
566
views
Does C# have a way to use a multi-interface declared instance, or something similar when applying ISP?
My understanding of ISP is that the "client" in the definition (see below) can mean either a class that implements the interface or an instance declared with 1 of the various interface options, based ...
0
votes
2
answers
390
views
Initializing singleton properties, in init or in sharedMyClass?
So I have a singleton in Objective-C, there's one static method exposed to access the one and only instance:
+ (id)sharedMyClass {
static MyClass* sharedMyClass = nil;
static ...
2
votes
2
answers
596
views
Which one is more efficient; a subclass of UITableViewController for multiple purposes or multiple sub classes each for a purpose?
Say I have two views (Table View for example) that I'd like them to do different stuff; each loads different data but behaviors are similar for most par except what happens when a cell tapped for ...
1
vote
0
answers
82
views
How to follow MVC in a standard iOS App theoritically?
I want to understand one thing in plain english that how do I actually use an standard MVC design pattern in iOS App.
I know about Modal View and Controller and theoretically I know what they do(...
7
votes
7
answers
3k
views
Why don't constructor return bool to indicate its success or failure without having to throw an exception?
Take C++ constructors for example, we know they don't return values. Why did Bjarne Stroustrup in the beginning decide not to allow constructor returning 'false' to indicate it fails, so that the run ...
2
votes
1
answer
986
views
In Objective-C,what is the naming convention around protocols and their implementation classes?
Is there a naming convention for protocols and concrete implementations of them in Objective-C? Specifically regarding a protocol that's used as an abstract 'service' or 'manager' class declaration.
...
0
votes
1
answer
105
views
Does variable type specification lead to any performance difference?
Let's say I have a very long method which basically creates a responsive and resizable layout for a user interface by using a few fixed values and a few variable ones taken from an element's ...
1
vote
2
answers
1k
views
Which design pattern to choose when supporting multiple analytic tools?
I have spent quite some time learning all possible design patterns but I cannot find the ideal one for the following case. I am developing an iOS app where we are using multiple analytics tools like ...