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.

A programming language that is an object-oriented Smalltalk-based extension to C. It was not developed by Apple but it is now heavily used by Apple in OSX and iOS.

194 questions
118
votes
5 answers

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 slides, of a comparison of those three languages…
Yellow
  • 1,273
  • 2
  • 9
  • 6
102
votes
5 answers

Clang warning flags for Objective-C development

As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags. I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless I have a really good reason not to turn it on. I…
Macmade
  • 1,146
  • 2
  • 8
  • 12
30
votes
3 answers

Is it considered a bad practice to add logic in a property setter?

I jumped in to a project and I see that the other developers are adding a lot of logic in the setters of synthesized properties. I understand how this works, but I think that it makes it hard to understand the flow of the program; while reading the…
phi
  • 423
  • 4
  • 5
26
votes
5 answers

MonoTouch vs Objective-C for iPhone/iPod/iPad development

For someone with .Net experience and wanting to develop for iPhone/iPod/iPad, is it worth learning Objective-C? Is MonoTouch a good alternative? What are some of the trade-offs when using MonoTouch vs coding in Objective-C?
ysolik
  • 6,340
  • 4
  • 34
  • 50
25
votes
2 answers

Why is Objective-C not widely used beyond Cocoa environments?

Objective-C features nice object orientation, simplicity, elegance, and (as a superset of C), low level ability. It could seem like the simple, modern alternative to C++ that many people look for and try to find in Go. But it is just used at Cocoa…
Toni Cárdenas
  • 359
  • 3
  • 6
24
votes
5 answers

success:/failure: blocks vs completion: block

I see two common patterns for blocks in Objective-C. One is a pair of success:/failure: blocks, the other is a single completion: block. For example, lets say I have a task that will return an object asynchronously and that task might fail. The…
Jeffery Thomas
  • 2,115
  • 1
  • 14
  • 19
23
votes
2 answers

Why does Swift not require semicolons?

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 end a line in Swift but if you do-at least from…
Memj
  • 335
  • 3
  • 8
23
votes
4 answers

Where does Objective-C fall in the language performance continuum?

There seems to be a lot of discussion of the various speed merits to C or C++ as compared to say Java or Python, but I rarely see Objective-C mentioned. Roughly where does it fall in terms of language performance?
Fomite
  • 2,616
  • 6
  • 18
  • 20
20
votes
7 answers

Continuous Integration : which frequency?

I've always launched builds after each commit, but on this new project, the architects just asked me to change the frequency to "one build every 15 minutes", and I just can't understand why that would be a good reason vs "building on each…
Valentin Rocher
  • 303
  • 1
  • 8
19
votes
6 answers

The importance of duplicate code removal

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 = [Reachability…
Iulian Onofrei
  • 303
  • 1
  • 12
15
votes
3 answers

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 for two basic and common screens: 1) The Form…
Ravul
  • 159
  • 1
  • 5
15
votes
2 answers

Does objective-c's method overhead make a 'many small methods' design approach inadvisable?

I generally favour using small methods, as recommended by, amongst others, Bob Martin in Clean Code. I've also read enough about Objective-C's internals to have at least some idea about how its message dispatch works (bbums series is particularly…
Cris
  • 250
  • 1
  • 8
15
votes
4 answers

Why do we need to write a header file?

Before you whip out your snarky comments, I know -- this is a nooby question. This is my first time using a C based language. I'm an undergrad student learning Objective C for a computer science course on mobile development. I know that, in an…
Hartley Brody
  • 344
  • 1
  • 2
  • 8
13
votes
7 answers

Getting My Head Around Immutability

I'm new to object-oriented programming, and one concept that has been taking me a while to grasp is immutability. I think the light bulb went off last night but I want to verify: When I come across statements that an immutable object cannot be…
Michael Mangold
  • 365
  • 1
  • 2
  • 11
13
votes
3 answers

Do people use const a lot when programming in Objective C?

Related: “sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers” warning Sometimes, I think it's useful though. I may need to pass an a table and want to make sure that the content of the table does not change. However, in…
user4951
  • 699
  • 6
  • 14
1
2 3
12 13