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.
-2
votes
0answers
64 views
How do I capitalize this method? [on hold]
I had a bit of a debate with my co-worker about whether this method header is correctly-capitalized:
- (CGFloat)cgFloatValue;
My co-worker would prefer it this way:
- (CGFloat)CGFloatValue;
Of ...
1
vote
0answers
16 views
How should I manage updates for a this document object?
I have a object model like Document->Section->Value but Value can also be a table type so I then have Value->Row->Column->Value.
The problem is that the object graph for a single document can be ...
0
votes
1answer
58 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 ...
0
votes
2answers
99 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 ...
2
votes
2answers
189 views
Do nested conditionals have a significant performance impact? [duplicate]
This is a question that lives in my mind from a long time.
Does the use of multiple nested conditional statements impact the performance of a taken code? So far I know that programmers have created a ...
1
vote
1answer
240 views
Mixing OOP and Non-OOP
I'm working on a command line interface text based game. I'm writing it in C but there are various ways in which I could refactor the code by using Objective-C:
using NSDictionary to allow me to ...
0
votes
1answer
75 views
Swift: Creating an empty array [closed]
The following:
var emptyArray = [String]();
What do I need the parentheses () for? [String] says, that the array accepts strings only. But why do I have to put the () there?
1
vote
0answers
39 views
Xcode rolling video architecture
I am going to writing an App that records video but to save on memory space I want to allow the user to continually record and then, when something happens, they can save that period of time (post the ...
7
votes
2answers
934 views
Why does Swift not require semicolons? [closed]
I normally code in either c# or Objective-C and recently took it upon myself to learn Apple's new programming language - Swift.
The first thing I noticed is that you don't need to add semicolons to ...
3
votes
3answers
524 views
Why does Objective-C store objects on the heap instead of on the stack?
I have a basic understanding of what a "stack" and "heap" are. You use a stack to store items in memory that should be read and/or removed in a last-in-first-read/removed manner. To steal another ...
1
vote
0answers
140 views
Securing a private API used by an iOS App
I have an app that uses an API server and I do not want to have anything other than it to be able to use that API. I know this isn't totally possible, but I want to do what I can.
I don't think my ...
4
votes
3answers
228 views
How do you define stateless methods while keeping them together in Objective-C?
I have a few methods which are stateless:
loginWithEmail: password: completion:
signUpWithEmail: password: completion:
resetPasswordForUsername: completion:
Currently what I do is I create a class ...
1
vote
1answer
187 views
Why isn't the isa pointer hardwired in Objective-C classes?
I've been studying the Objective-C runtime for some years, and even hacked libobjc a little bit (both Apple's and GNUStep's), and I've been wondering about a design decision on the compilers.
Every ...
0
votes
2answers
329 views
Why can't I use an operator like plus sign to concatenate strings? [closed]
Why in Objective-C we should be typing explicit references to methods like stringByAppendingString to concatenate strings, when in some other languages we can use operators for that?
For example, ...
4
votes
1answer
194 views
Is Apple sample code the “correct” way to go?
I'm in a place were I know how to build apps and have submitted at least 5 for different clients to the app store and wanted to step up my game. So of course I went to Apple resources and analyse the ...
5
votes
1answer
216 views
Why check if object is nil
What's the point of the if statement in the following code:
- (NSArray *)myMethod
{
NSArray *array = nil;
if (!array) {
array = [[NSArray alloc] initWithObjects...]
}
return ...
0
votes
0answers
48 views
Abstracting AutoLayout sensibly - why is this so conceptually tough and where should I begin?
Below are some babbling, probably incoherent thoughts, but I am so stuck on this problem and I feel like an elegant solution is possible.
Though it is indisputably awesome, and makes programatic view ...
1
vote
1answer
101 views
Is Objective-C the only language with infix arguments?
One of the things I like about Objective-C is the use of infix arguments when calling a method.
[myDictionary setObject:myObject forKey:@"key"];
where the method name is setObject:forKey:.
Does any ...
2
votes
2answers
237 views
Example of writing unit test for a method
I am writing unit tests for an iOS application. I clearly understand the benefits of writing unit tests & TDD, but I am confused about what kind of tests you can write for methods like this;
...
1
vote
1answer
93 views
Objective-c anonymous property coding style
If I have an interface defined like
@interface MyClass
@property (nonatomic, copy, readonly) NSString *myString;
@end
so that myString is externally visible but can't be written, what would be ...
0
votes
1answer
1k views
How static functions are better than Class Methods in Objective-C [closed]
I was going to through this post by Mattt Thompson in which he mentions that
Static functions are nicer than shoe-horned class methods
I just don't see any flaw with Class methods in ...
5
votes
1answer
766 views
How do you write tests for methods that interact with data in system files?
I'm trying to be proactive about writing an iOS app in a test-driven manner. However, I'm stumped as to how to test a method that is to interact with real system files. For those familiar with iOS, ...
-2
votes
1answer
154 views
How come the keyword for declaring a class is 'interface' [closed]
What is the relationship between a class and an interface in objective-c? How come we declare a class using @interface instead of @class?
1
vote
1answer
274 views
Does key-value observing between model and view violate MVC?
In MVC the Controller is the go-between for the View and the Model. So the Controller should be the one that observes or receives changes from the Model and View and updates the other accordingly. I ...
13
votes
3answers
2k views
Massive View Controller - IOS - Solutions
I'm sure every new iOS developer has the following problem: The View Controllers get very fast crowded with code for various purposes, easily getting to 500 + lines of code.
This is how it looks like ...
2
votes
1answer
671 views
Performance of Class methods vs singleton instance methods
In my app, I'm using both strategies:
I have a Utils class, it only has class methods that I call for doing common global methods, like NSString validation, etc.
I have an app-wide singleton class ...
4
votes
1answer
1k views
Inheritance, Composition and Protocols
I'm reading a book on general object oriented concepts to try and gain a solid understanding of everything. One thing that is throwing me off is the difference between Inheritance and Composition. I ...
12
votes
1answer
689 views
Naming convention for iOS/OSX open-source projects
Not always but most of the time, you will find iOS or Mac OS X open-source projects with names starting with the initial letters of the author first and last names. If a project were to be authored by ...
0
votes
1answer
184 views
Do iOS frameworks require the same internal versioning as OSX frameworks?
I have been reading through the apple documentation for creating frameworks for OSX and iOS.
Reading about the structure of frameworks, I began to wonder if there is really any need to create the ...
1
vote
4answers
312 views
Security in an iOS game?
I'm part of a team building an iOS game which has multiplayer elements.
A concern right now is how to make the game more secure, from user manipulation. I know there's a lot of multiplayer games out ...
19
votes
6answers
2k views
The importance of duplicate code removal [duplicate]
I tried to explain to a coworker the gravity of having duplicate code in a project, on this piece of code:
+ (void)createIapInParse:(SKPaymentTransaction *)transaction {
Reachability *reach = ...
0
votes
1answer
191 views
What effect does using multiple childViewControllers views inside a ContainerViewController have on memory?
I have three childViewController views inside my ContainerViewController and these three views are inside a horizontal scroll view. My intention is to build an app that has a custom camera on one ...
0
votes
1answer
172 views
Macro guard in Objective-C
I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files.
Im aware that the #import directive, which works exactly like ...
0
votes
1answer
385 views
Approach to managing multiple services like Evernote, Google drive, dropbox in iOS
I'm trying to think up a scenario when I'd have three different forms of NSData (or whatever) to be sent to three different services like Evernote, Google drive, Dropbox. Granted, each of those has ...
0
votes
1answer
386 views
How does Telnet work?
Is telnet just a simple socket connection?
I usually have a difficult time in the networking area so I use some code from the internet to help me out, but I can't seem to find a library for Telnet in ...
102
votes
5answers
49k views
How can Swift be so much faster than Objective-C in these comparisons?
Apple launched its new programming language Swift at WWDC14. In the presentation, they made some performance comparisons between Objective-C and Python. The following is a picture of one of their ...
1
vote
1answer
151 views
Should I implement a function or a method?
Once in a while I encounter a C function in my colleagues' code.
Mostly it is in some helpful objective categories, and those functions are mostly an internal calculation of something or a ...
2
votes
1answer
7k views
Calling static method from instance of class
As a developer I am fan of static methods.
Recently I come across difference between OOP languages about this static methods.
All OOP language use static method to access any method without ...
0
votes
1answer
106 views
Drawbacks to redefining method in precompiled header
I have a lot of calls to NSLog(...). I need to change all of these calls to CLSNSLog(...).
So I added this to my precompiled header (.pch):
#import <CrashlyticsFramework/Crashlytics.h>
#define ...
1
vote
1answer
252 views
Manage the persistence of entities on iOS in several places: CoreData on the device, iCloud and on a REST API
For the needs of a project, I would persist the datas contained in Core Data in several places depending on the state of the user.
If the user is logged to my API -> Persist the datas on my API.
...
1
vote
0answers
743 views
What are the bad points of using Core Data for iOS like an ORM
I just starting to use Core Data for my iOS app and I am thinking about how use Core Data for my needs.
What are the features of my app:
The user look for products proposed from a catalog.
The user ...
4
votes
2answers
2k views
Objective-C style: Do I implement factory methods or init methods?
I'm new to Objective-C programming, and creating various classes for an iOS application I'm working on.
When creating objects, it seems like many classes in the built-in frameworks use the "static ...
0
votes
0answers
281 views
Delegate method privately called from delegate itself?
One has established design patterns so ingrained in their brain, that when sometimes somebody does something unexpected, it is a revelation.
My colleague in an iOS project did call the delegate ...
1
vote
2answers
425 views
How can NSObject contain an NSString if NSString is an NSObject
How can NSObject contain an NSString if NSString is an NSObject
/* NSObject.h
Copyright (c) 1994-2012, Apple Inc. All rights reserved.
*/
(NSString *)description;
NSObject has a property named ...
0
votes
0answers
50 views
Use Objective-C protocols like Java interfaces [duplicate]
I'm a Java developer moving to Objective-C.
So far in Objective-C I've seen protocols used extensively to implement the delegate pattern, but I haven't seen then to add a layer of abstraction in the ...
0
votes
1answer
165 views
Significance of many-to-many relationships? [closed]
How important are to-many relationships in iOS programming? Do you often hold a list of pointers to objects in an array in your codes?
I don't think I fully understand the concept of to-many ...
0
votes
1answer
274 views
In objective C, where does the inheritance chain end? [closed]
In objective C, classes are objects, but what object owns the class objects?
I am trying to get as detailed an understanding of iOS programming as I can, and this question popped into my head, so I ...
1
vote
1answer
110 views
Is it bad practice to include two types of views in the same class?
In my app, I use a widget with a loading spinner to signify that a network request is waiting.
On failure, there will be another view which contains a failure message and a "Reload" button.
My ...
0
votes
2answers
226 views
How to remove redundant code that enables button. Or “if” statement
I got probably "micro optimization" problem.
I got "History number", "Next Number", "Reset" buttons, as well "label" for text.
Every time I click At "Next number" button I would like to show random ...
1
vote
4answers
338 views
Difference between the two enums
I came across an enum definition :-
typedef enum NSInteger {
kBorderTypeNone = 0,
kBorderTypeLeft = 1 << 0,
kBorderTypeRight = 1 << 1,
kBorderTypeTop = 1 << ...