Questions tagged [cocoa]

Cocoa is Apple's application-development framework for macOS, consisting of Foundation, Application Kit, and Core Data.

Filter by
Sorted by
Tagged with
3 votes
1 answer
126 views

UITableView allowing some kinds of requests to be deleted with swipe gestures

I have a tableview which shows a list of objects called Requests. It has 3 segments. Namely Accepted, Received and Sent. And the objects for each segment are in 3 arrays. I want to enable deleting ...
user avatar
  • 331
4 votes
0 answers
121 views

Swift iOS app for showing motivational quotes, with multiple screens

I'm one month into self-learning Swift, and I would like some advice to improve my coding skills. I have listed 2 situations that I think I need to improve. I'd like some feedback focusing on my use ...
user avatar
  • 61
2 votes
1 answer
66 views

Playing a sound depending on the currently displayed flash card image

I've developed a fully working flash card app for kids. It has a UIImageView that cycles through 26 cards (abcs) via a gesture click and a music button that will ...
user avatar
  • 23
1 vote
0 answers
549 views

Swift lazy observe and mutate pattern for arrays

I am using the following pattern in my code. It works. But, it feels as though it is on the edge of what should work! Should I consider an alternative? I have an array in my class that maps an ...
user avatar
  • 111
1 vote
1 answer
113 views

A quiz to practice some of the notion of the chapter four of app development with swift

I just want feedback about the code. Better implementation, more commentary etc. app Delegate.swift ...
user avatar
2 votes
2 answers
10k views

Form for OTP entry with six single-character text fields

I am working on an app in which I have to pass 6 digits OTP through 6 textFields in which you to provide only one character and after that it automatically goes to ...
user avatar
  • 121
3 votes
0 answers
78 views

Probability shooting game

I've been working on this probability game that has a gun with 5/6 bullets. When there's a dodge the game removes a bullet and then the game continues, the goal being to get to 0 bullets. I don't ...
user avatar
1 vote
1 answer
68 views

Damage or Heal based on the buttons you press

If you press the damage button, it will damage armor before health. If you press the heal button, it will heal armor before health. The project is here: https://github.com/austingaee/DamageHealth-...
user avatar
  • 1,070
1 vote
1 answer
110 views

Swift UITableViewCell class to show cameras, ratings for a car wash and other information

I have an UITableViewCell class that written in Swift. And it seems to me that I did it the wrong way. It works fine, but I want improve the code or refactor it somehow to make it look better. Any ...
user avatar
1 vote
2 answers
1k views

iOS tableView with two special rows of headers

Using swift for iOS, here is my cellforRow method ...
user avatar
  • 156
3 votes
0 answers
1k views

Applying Gaussian blur to UILabel

Here is the code and it is really slow, like seconds slow to render about 25 labels. ...
user avatar
  • 131
2 votes
1 answer
636 views

Set a UITableViewAccessoryType in a single UITableViewController used for two different purposes

I have a UITableViewController that displays a list of lift names (think weightlifting) and it's used for two different things. It can be accessed from view A to select a lift that will be saved as a ...
user avatar
  • 205
6 votes
1 answer
1k views

Simple Tip Calculator

This is something I put together recently, and I thought I would see if anyone had any recommendations for modification of this short implementation of a tip calculator. The calculator uses a ...
user avatar
3 votes
1 answer
372 views

Populating a UITableView with staff members using Firebase data

The end user will be able to see a list of staff that works at a church. The staff consists of 5 individuals with 5 different position titles (Minister, Pastor, etc.). This data is pulled from ...
user avatar
3 votes
1 answer
21k views

Allow UITextView to resize as the user is typing

I want to be sure that in terms of auto-layout or just following the proper methods of doing the following is acceptable. I am not sure if there will be an constraint issues or efficiency problems ...
user avatar
1 vote
2 answers
216 views

Checking for required text fields for login

I wrote this script and it's working quite well however I think there's too much if else statements on it. How could I change them for a switch statement? ...
user avatar
3 votes
1 answer
9k views

Displaying JSON data from a server in a UICollectionView

This code pulls JSON from a server and delivers some data like imageURL, titleString and ...
user avatar
  • 33
1 vote
1 answer
9k views

Accessing a UIView's parent UIViewController using the UIResponder chain

I recently found a static C function on Stack Overflow which returns a UIViewController reference from a containing subview using the responder chain: ...
user avatar
  • 571
4 votes
2 answers
814 views

Big Nerd Ranch Bronze Challenge: Disallow Alphabetic Characters

I just completed BNR's bronze challenge for disallowing alphabetic characters, and would love some feedback on what I did right and wrong, and how I can improve my code for reusability and ...
user avatar
3 votes
0 answers
6k views

Multiple View Controllers in a Single Window (Swift on OS X)

As an exercise I want to have a single window application (in Swift on Mac OS X) with 4 views, each controlled by an independent view controller and have their own XIB file. I have working code, but I ...
user avatar
5 votes
1 answer
187 views

Non-concurrent write creates bottleneck

I have some efficient methods that recursively creates a tree structure (NSTreeNode) of by looping recursively over a directory structure. The result is displayed ...
user avatar
5 votes
1 answer
2k views

Road to MVC: the case of Settings Table View Controller

Now that I know that MVC can help do better code, I want to make my SettingsTableViewController class conform to it. ...
user avatar
5 votes
2 answers
936 views

Spawning a Dog class

When the app is run on an iPhone or simulator, tapping the screen spawns a dog class and displays an image of the dog. I'd like comments, issues, whatever. Is this a decent first Objective-C project, ...
user avatar
5 votes
1 answer
5k views

Presenting modal dialogs from XIB in Cocoa: best/shortest pattern?

Below is my typical WindowController module for presenting a modal dialog (could be settings, asking username/password, etc) loaded from a XIB. It seems a bit too complex for something like this. Any ...
user avatar
  • 161
2 votes
1 answer
2k views

Reviewing C function which captures the screen

I have created a function in C on OSX in Xcode which captures the screen, adds the mouse pointer to the image, rescales the image to fit a certain width X height requirement, and puts the rescaled ...
user avatar
4 votes
1 answer
119 views

Is there a better way to make sure a variable is initialized when using blocks?

I have a method to provide an NSManagedObjectContext using UIManagedDocument. I need to ensure that the ...
user avatar
  • 223
3 votes
1 answer
5k views

Spliting string to array by number

I have two functions to split string to array of strings. Input string is: (1Letter E|V|R) + 8 number, last component of string (1Letter + V) + 8 or less numbers. I'v got two functions advised to ...
user avatar
  • 147
3 votes
2 answers
542 views

Storing and iterating over multiple NSError pointers

How would you refactor this kind of code? I've unsuccessfully tried several approaches (NSArray, NSPointerArray, plain C array), but always ran into pointer type checking error. ...
user avatar
2 votes
4 answers
571 views

Is there anything wrong with this unusual NSMutableArray setter?

This behaves to an outside observer mostly like @property (copy), except it has the very nice property of automatically performing any side effects that may exist ...
user avatar
  • 173
3 votes
1 answer
234 views

How could this constructor code be improved?

How could this constructor code be improved? I feel like I'm not doing something optimally here... ...
user avatar
2 votes
1 answer
277 views

Server-loaded buildings function for an iOS game

I'm working on a game for iOS devices and this is the function we use to create server-loaded buildings. The server loading is in another function and everything works just fine, but I was wondering ...
user avatar
  • 123
5 votes
1 answer
680 views

OpenGL game edit view

I'm working on a Cocoa project that uses OpenGL. I'm trying to keep things easily cross-platformable for later (which is the primary reason for my GL singleton; I hope to implement Linux versions of ...
user avatar
  • 173
1 vote
2 answers
496 views

Setting the path to toolbarAssociatedXibName, with fallback

I have some code that I've included in a project I want to release. Here is one such block: ...
user avatar
4 votes
3 answers
700 views

Initializing a window in Cocoa

This is some of the code I have: ...
user avatar