A late-binding, message-based, object-oriented language that is a strict superset of C and is primarily used for programming on Apple's Mac OS X and iOS platforms. Objective-C can also be used on other platforms that support gcc or clang.

learn more… | top users | synonyms

1
vote
1answer
78 views

Repurposing UITableView infinite scroll configuration/properties

Had my first go at implementing infinite scrolling for UITableView's in my iOS app last night, and I noticed I ended up copying/pasting quite a bit of boilerplate from one VC to the next (if I wanted ...
11
votes
1answer
603 views

Rewrite code from Objective-C to conform with Swift power tools and concise style

I started a project with Objective-C and rewrote it with Swift. The project contains two UITableViewControllers: MasterViewController and DetailViewController. ...
3
votes
1answer
40 views

Factory Class for Game World

The world in my strategy game is comprised of a number of towers. At the start of the game, only one tower is generated, and when the player discovers new towers they are created and added to the ...
3
votes
1answer
44 views

Complex Conditionals in a Strategy Game

I have been looking at this method for a long time and I have finally refactored it into something that I believe is much more readable. I am not totally happy with it though so I would like to get ...
6
votes
2answers
184 views

Array from file

I have this code which is performed each time I click the 'show polygons' button. The problem is that it takes a few seconds to finish running through the code before actually drawing the polygons + ...
10
votes
4answers
457 views

Prime Factorization

I'm doing an Objective-C project and I need to do some prime factorization and so I came up with the following algorithm which is 99% C, except for the array part which was easiest to implement in ...
0
votes
1answer
61 views

Making a webService file smaller [closed]

I'm developing an iOS app, and I have a file, WebService.m, that is now 2300 lines long. My file contains all the web service calls on my app, with their parsing if successful, like: ...
3
votes
2answers
67 views

Keeping UI code DRY in iOS projects

I've subclassed UI button and used it in my View Controller's viewDidLoad method, like so: ...
3
votes
1answer
45 views

Loop Animation on several UIButton's NSLayoutConstraint

I took the belated plunge to look at Autolayout. Normally I'd animate based on a UIView's frame (i.e I'd have used the following): ...
-1
votes
0answers
61 views

Thread-safe, in-memory LRU cache with a max item count of 10 - follow-up

The following code is the revised/feedback version of my previous post. The big change was converting RicCache class object to an instantiated object. I'm ...
3
votes
2answers
51 views

Thread-safe, in-memory LRU cache with a maximum item count of 10

I'm attempting to master LRU Caching. It must be thread safe, and it should preferably perform as well as web image-cache, (avg ~1MB). Please take a look to see if there's anything wrong, amiss, ...
3
votes
2answers
66 views

Should this Method be in TableViewCell or ViewController?

I have a custom tableview cell for displaying different foods, with a star next to each name. If the food has been favorited (i.e., it exists in the database), the star is filled in, otherwise it is ...
4
votes
1answer
34 views

Model class for networking that uses notifications

I just finished a model class that represents an Instagram Networking client for my iOS app. I am specifically looking for a review of my use of static constants. These are strings that represent ...
6
votes
1answer
47 views

Clustering markers on Google map on zoom

I have a method that is getting called when someone zooms camera on the map (Google map). I recalculate the positions of markers of map and the code is clunky and not effective. I iterate over arrays ...
5
votes
2answers
135 views

Directory listing model

I need a class to read and store directory structure. This is my first step in Objective C so I ask to you to say what you think. Header file: ...
11
votes
3answers
240 views

Using a Dictionary to retrieve BOOL values

I have some values pulled from a web service giving me a bool value for a key. I did it this way, but feel like it is repeating without need. How can I refactor this? Please note that the key on ...
6
votes
1answer
80 views

API for SQLConnect Library

I've designed a library for connecting Objective-C (and now Swift) apps to Microsoft SQL Server 2005+. (I believe there are other databases it works with, but I've only tested with MSSQL.) The ...
3
votes
2answers
42 views

Further refactored Model class that represents a calculator

Here is my Model class's new header file: ...
4
votes
3answers
73 views

Model class representing a calculator

I have a simple Model class that represents a calculator. Here is it's header file: ...
4
votes
1answer
55 views

Downloading and Loading Remote Game Assets

On advice from an answer to my previous question, I have written some code that will allow my game balance properties to be loaded from a remote server. Right now I am just hosting the raw property ...
3
votes
1answer
48 views

Game Balance and where to store Variables

I have been thinking about this aspect of my game for a little while, and I have come up with the following solution. I am sure that there are problems with the way I have implemented it so any kind ...
-1
votes
3answers
172 views

iOS coding style

I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code. ...
4
votes
1answer
64 views

Game Achievements without Singleton

This is my first time implementing achievements in a game so I could definitely use some feedback on what I have done here. I have heard about singleton approaches to this problem, but I did not feel ...
2
votes
1answer
52 views

Find the nearest (small) number x where x can be represented by sum of cubes

I recently came across a problem where a number \$x\$ is given and I have to find \$y\$: \$y < x > 1\$ \$y\$ can be expressed as \$a^3 + b^3\$ (more than one combination) Example: If 4105 ...
7
votes
1answer
104 views

Loading and Using Lua Scripts

I have been experimenting with integrating Lua into Objective-C. I have tried to do the bare minimum to get Lua to compute values and return them. I did not want to use any external libraries so I ...
6
votes
2answers
74 views

Convert numbers into a textual form

So this was originally inspired by @nhgrif's Int extension for translating integer to plain English, however the code is mainly a port of @rolfl's Converting a number to the text representation; ...
7
votes
3answers
165 views

Trading Card Game Prototype in OOP

So I am sure there are better ways to set this up, but I wanted to see how something like this would work in Objective-C, so I went ahead and built a prototype of a Tradeable Card Game. I've never ...
12
votes
3answers
204 views

SQLConnect - A library for connecting Objective-C/Swift applications to Microsoft SQL Server

The complete SQLConnect library can be found here. The file from which the following method belongs can be found here. At some point I may or may not open questions for reviewing other aspects of ...
7
votes
2answers
83 views

Ability Cards that trigger Game logic

I want to ask this question because I have been thinking about it for a while and I haven't discovered a solution that I am very happy with. When coding games, I've frequently run into the situation ...
4
votes
2answers
95 views

Class refactoring including changing instance methods to class methods and adding singletons

My main goal with this refactor was to change instance methods that should have been class methods in the first place into class methods. My secondary goal was to add singletons to these classes ...
7
votes
1answer
70 views

AI Governor to Play a Strategy Game

I had the idea the other day to implement an artificial intelligence that could play my strategy game. This could be useful in a variety of different ways. For example, the player could "lose ...
6
votes
1answer
87 views

Objective-C code clean up

I am tasked with cleaning up someone else Objective-C code, and will admit, it is not my language of choice. I am not sure if this is a valid question but was hoping someone could double check my ...
10
votes
4answers
898 views

Decision Table for the Movement AI in a Game

I posted a question on Stack Overflow about how to implement Decision Tables in Objective-C after reading about them for the first time in chapter 18 of Code Complete. Nobody provided an answer, so ...
12
votes
3answers
335 views

A flashing ! exclamation ! point ! bar

I have this Objective-C code for use in an iOS app that makes a 'bar' on the screen, with a red exclamation mark that flashes in it at random places. Here's what it looks like: Header file: ...
1
vote
2answers
133 views

Passing Row Index of TableViewCell (custom) to another view controller [closed]

I have been trying to achieve the below requirements to get them working. Am I doing it the right way? We have a table with customised Cell (say: ...
3
votes
3answers
75 views

Working with Classes (inheriting), @ properties and Initialization

I'm working on this Objective C programming assignment I found online. I'm not sure if I have met all the requirements, especially part C. Any help or suggestion will be appreciated. Part 6 ...
5
votes
2answers
87 views

Parsing Websites and transferring Data between Objects

I have a DiningHall class that has the 3 properties: openingTime, closingTime, and ...
3
votes
1answer
52 views

Revised worker movement AI for strategy game

A while ago I posted this question about worker AI and Job Queues for a strategy game. I have posted other questions about the Job Queue, and now I would like to post this revised question about ...
4
votes
1answer
110 views

Seeking improved Objective-C permutation algorithm

This algorithm seeks to find all of the possible permutations of a word: ...
3
votes
1answer
61 views

Potentially superfluous iOS interface system

I have written an interface system for iOS that allows interface elements to be moved around on the screen as actors move around on stage. It can operate within a ...
4
votes
1answer
86 views

Created 2 new classes to represent my backend service and persisted data in iOS app

I just created 2 model class for my iOS app: HALUserDefaults represents the persisted data in my app. It has the ability to both retrieve persisted data and store ...
10
votes
1answer
69 views

Immutable Fraction class

Inspired by this question: Fraction class implemented in Objective-C, I have written what I feel is an improved version of the Fraction class in Objective-C. As per the tips in this answer, the class ...
7
votes
5answers
403 views

Fraction class implemented in Objective-C

Inspired by this question: Fraction (rational number) structure with custom operators, I have written this class for doing some simple work with fractions. ...
7
votes
5answers
527 views

FizzBuzz in Objective-C

In my quest for learning Objective-C, I have created the common FizzBuzz code in it. This is due to a suggestion/challenge from @nhgrif to re-implement anything he does in Swift in Objective-C. ...
11
votes
2answers
2k views

Is it still necessary to check for a front camera?

I'm trying to clean up redundant old code, so I'm asking this general question. Since all iOS 7 devices have a front camera, would it be safe to remove the code to check if the device has a front ...
4
votes
1answer
68 views

Cleaned up a small MVC refactor in iOS app

I have a view controller on my app, where the user is shown a table view. The table view displays their address book contacts and allows the user to select any friends that they would like to invite ...
3
votes
1answer
45 views

Filling text boxes with player names received from an array

I'm currently trying to make the code of an app I'm developing a bit more efficient and easier to read. Basically what this does is after the user taps with two fingers (gesture) it retrieves a ...
3
votes
1answer
67 views

Very small start to MVC refactor in iOS app

I started to refactor my app to MVC today. I wasted a lot of time because of simple mistakes. One was I kept trying to access the getter method inside of my custom getter method, which just causes ...
5
votes
2answers
85 views

Revised Job Queue for Strategy Game

After posting my previous question about this Job Queue, I decided I wasn't actually very happy with it. I am embarrassed to admit that upon further testing it did not function properly in all ...
5
votes
1answer
177 views

Replacing occurrences in NSString and NSMutableString

I ran it and it's working, but I just want someone to double check that I followed the directions. Any suggestions or corrections will be appreciated. Assume you have a ...