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
1answer
70 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 ...
4
votes
0answers
55 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 ...
2
votes
1answer
45 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 ...
1
vote
0answers
68 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 ...
1
vote
1answer
97 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 ...
2
votes
2answers
4k 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 ...
3
votes
0answers
62 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 ...
1
vote
1answer
60 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-...
1
vote
1answer
95 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 ...
1
vote
2answers
761 views

iOS tableView with two special rows of headers

Using swift for iOS, here is my cellforRow method ...
3
votes
0answers
565 views

Applying Gaussian blur to UILabel

Here is the code and it is really slow, like seconds slow to render about 25 labels. ...
2
votes
1answer
627 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 ...
6
votes
1answer
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 ...
2
votes
1answer
283 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 ...
3
votes
1answer
17k 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 ...
1
vote
2answers
209 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? ...
3
votes
1answer
7k 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 ...
1
vote
1answer
8k 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: ...
4
votes
2answers
739 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 ...
3
votes
0answers
5k 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 ...
5
votes
1answer
168 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 ...
5
votes
1answer
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. ...
5
votes
2answers
930 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, ...
5
votes
1answer
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 ...
2
votes
1answer
1k 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 ...
4
votes
1answer
116 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 ...
3
votes
1answer
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 ...
3
votes
2answers
510 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. ...
2
votes
4answers
566 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 ...
3
votes
1answer
230 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... ...
2
votes
1answer
275 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 ...
5
votes
1answer
662 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 ...
1
vote
2answers
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: ...
3
votes
3answers
659 views

Initializing a window in Cocoa

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