Questions tagged [objective-c]

This tag should be used only on questions that are about Objective-C features or depend on code in the language. The tags [cocoa] and [cocoa-touch] should be used to ask about Apple's frameworks or classes. Use the related tags [ios] and [osx] for issues specific to those platforms.

Filter by
Sorted by
Tagged with
0 votes
0 answers
142 views

Generating an array texture in Metal (MacOS)

Provided is the code to create and populate the array textures in a game that uses tileable 32x32 textures for voxel faces. The idea is to have 3 different texture arrays for textures with different ...
user16217248's user avatar
3 votes
1 answer
181 views

A periodic implementation for C++ using Grand Central Dispatch

I have a C++ project which needs a few periodic timers. I have created a timer class for this project using Grand Central Dispatch. I tried using boost::asio, but ...
Virag Doshi's user avatar
2 votes
2 answers
195 views

Replace Western Arabic numerals with Persian digits

I've written and used this code in my apps whenever needed to convert any Western Arabic numerals into Eastern Arabic (or better say, Persian/Farsi) numerals in any Persian text. It works fine as ...
Neeku's user avatar
  • 121
1 vote
3 answers
73 views

How to use string constants correctly

I often get into the dilemma of how to use string constants, this is the way I use now: ...
Nullable's user avatar
  • 133
4 votes
1 answer
812 views

Objective C String to JSON formatting

Quick disclaimer. I've programmed Java for years but this is the first Objective C I've ever written. I've written some code which almost unfortunately works but frankly hurts my eyes with the number ...
John Williamson's user avatar
2 votes
2 answers
459 views

Convert C to Swift

I trying to convert this C code for calculating distance from RSSI to Swift code. I try to do it by myself, but considering I'm beginner, I need help in how to do it. Here is C code: ...
Win Fan's user avatar
  • 23
2 votes
1 answer
53 views

iOS Attributes in the data model

I am working on a product-related app where the data model for a product attribute feels too heavy. But I can't split it into several small data models because they are all about goods. At present, ...
Nullable's user avatar
  • 133
4 votes
2 answers
492 views

SIMD Mandelbrot calculation

I was messing around with GPU compute shaders the other day and created a Mandelbrot shader. Unfortunately, Metal doesn't support double-precision in compute shaders, so beyond a certain zoom level, I ...
user1118321's user avatar
  • 11.6k
-2 votes
1 answer
163 views

3D vectors in Objective C

I am trying to learn Objective C and want to make sure I am following the proper practices/convention. I would very much appreciate advice on what to change/improve I also have some questions: when ...
Mumphus's user avatar
  • 113
4 votes
2 answers
1k views

Translating Objective-C use of static and +(void)initialize to Swift

I am converting an old Objective-C class into Swift. My actual question is at the very end after all of the code. Here is a cut-down version of the Objective-C class: DateInfo.h: ...
rmaddy's user avatar
  • 195
5 votes
1 answer
423 views

Point distance program written without a framework

I have been developing a cross-platform game based on open C libraries (mainly glfw) with a direct focus on Windows development. The beginning of my programming career taught me familiarity in ...
dylanweber's user avatar
2 votes
1 answer
58 views

Checking user verification status

The User story is as follows: Users are allowed to get "verified", so other users know they have passed a background check. After tapping "get verified" button, or the "verification badge" ...
AnonProgrammer's user avatar
1 vote
0 answers
142 views

UICollectionViewCell's content layout misbehaves when UICollectionView scrolls to the top of the screen

UICollectionViewCell's content misbehaves , the layout animates, when UICollectionView scrolls to the top of the screen. I am asking here, because it looks like an apple's bug. looks like squeezed ...
dengApro's user avatar
  • 391
5 votes
1 answer
706 views

Creating directory within Application Support, and preventing iCloud backup

I'm using react native to build an iOS app, but have little to no experience in obj C or iOS development. The app I'm building has a bunch of content files that aren't user specific, will be ...
Ben's user avatar
  • 51
0 votes
2 answers
724 views

Multiple AFNetworking calls In a view controller

Multiple AFNetworking calls In a view controller. The code is very wield. I think , to negotiate with the server , and combine those into one url, instead of many urls. ...
dengApro's user avatar
  • 391
0 votes
1 answer
236 views

Objective-C and AFNetworking

This is Objective-C and about Networking Request. Just set the AFNetWorking Manager and get method name from the method lists below (it is all Post request). The way we take now is quite weird. If ...
dengApro's user avatar
  • 391
0 votes
2 answers
536 views

Sychronous wrapper around UIApplication.openURL:options:completion:

I am deprecating iOS 9 on a project. One of the differences in the framework is that the openURL method has changed. iOS 9 - (BOOL)openURL:(NSURL *)url; iOS 10 ...
gprasant's user avatar
  • 101
0 votes
2 answers
251 views

Optimizing UITableViewCell with singleton property

In UITableViewCell class, I have two properties: UINavigationController ...
dengApro's user avatar
  • 391
4 votes
2 answers
684 views

A C++ wrapper for Apple CoreFoundation

The wrapper makes it easy to manage memory when using CoreFoundation objects. It aims to act like a simple shared_ptr. Here is a usage example: ...
Ben-Uri's user avatar
  • 143
-1 votes
2 answers
117 views

Up/down arrow key commands

There are sources with these rules. I've listed the source too much, but I want to make it shorter and easier. ...
user avatar
2 votes
1 answer
628 views

Objective C implementation of Swift's if-let

This [Objective-]C-preprocessor macro currently handles single-variable if-let-not-nil and if-let-is-type, but doesn't handle multiple simultaneous tests and doesn't handle ...
BenRW's user avatar
  • 121
2 votes
1 answer
2k views

Populate TableView with JSON data

I basically want to display JSON data in a TableView. The TableView always displays a List ...
user7802048's user avatar
6 votes
0 answers
2k views

Iterate through all the photo library in iOS

This function is supposed to return a map of all unique local identifiers of images that are on the iPhone using the IOS Photos Framework. (it is a map so nSnull or (any object can be mapped to it) ...
Noam Segev's user avatar
6 votes
2 answers
63 views

Checking for many alertable conditions before saving customer information

What's the best way to refactor this code? The method does a lot of checking before showing an alert. And the method is too long for my taste. I'm thinking of extracting the checkers into their own ...
Vilowapo's user avatar
13 votes
1 answer
1k views

Interview coding challenge for iOS Part 2 - the application in Objective-C and Swift

I recently interviewed with a company that needed a C/C++ programmer to work on the iOS side of the products. The job description indicated they needed someone with 4 years of Objective-C and iOS ...
pacmaninbw's user avatar
5 votes
1 answer
839 views

Interview Coding Challeng for iOS Part 1 - the Static Objective-C Library

I recently interviewed with a company that needed a C/C++ programmer to work on the iOS side of the products. The job description indicated they needed someone with 4 years of Objective-C and iOS ...
pacmaninbw's user avatar
3 votes
1 answer
376 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 ...
Joshua Hart's user avatar
2 votes
0 answers
207 views

Throttling several HTTP parallell requests

I'm using the above piece of code to do some HTTP calls in parallel. This loop is running inside a NSOperation. I must throttle a bit the requests (so I don't overload the server). The code is working ...
webo80's user avatar
  • 121
2 votes
1 answer
178 views

CommandLine StreamFormatTester

Using Chris Adamson's book Learning Core Audio I'm getting familiar with Core Audio for Mac/iOS. The code examples are 100% Objective-C. I'm trying to follow along using Swift 3. This small piece of ...
user avatar
1 vote
2 answers
3k views

Checking that a 6-digit number is not repeated and not in sequence

Following is the objective C code snippet to check that the 6-digit number is not repeated and not in sequence/reverse-sequence. I have just printed the proper messages in ...
korat prashant's user avatar
1 vote
0 answers
753 views

Mocking protocol with class/static functions in Swift

I am using one of the open-source Objective-C keychain wrappers to store data in iOS keychain. For test cases, I have created protocol as: ...
D4ttatraya's user avatar
-1 votes
2 answers
288 views

Initializing a big static array for a card-based iOS app

I have a card-based iOS app that uses a sizable static array of cards. Each card has several properties, mostly strings, numbers and boolean. The first version of this app had 3-4 properties. The ...
Zonker.in.Geneva's user avatar
3 votes
2 answers
109 views

Create a stack implementation that handles the multi thread scenario

MyStack.h @interface MyStack : NSObject - (id)pop; - (void)pushObject:(id)object; @end MyStack.m ...
Ayush Goel's user avatar
1 vote
1 answer
950 views

Controlling Drone with iOS Speech Recognition

I got a Parrot Mambo which comes with an SDK for creating your own app for controlling it. I decided to use the iOS Speech Recognition library so I could use basic voice commands to control it. The ...
Sawyer05's user avatar
  • 113
4 votes
1 answer
2k views

Check for iOS version

Here's an approach i came up with for checking IOS versions. ...
damote's user avatar
  • 141
1 vote
1 answer
84 views

Hard-coded iOS keyboard [closed]

I am starting to write code for a keyboard in iOS. It's pretty much hard-coded and I need suggestions on how I can make it more professional style and more efficient. ...
Souliyo Vongdala's user avatar
1 vote
1 answer
1k views

Using a webservice with blocks and returning data via callback

I load some data from from my webservice via a method using blocks and callbacks. From my ViewController I make a request to the data loading class and pass the ...
Code's user avatar
  • 63
3 votes
1 answer
511 views

Storing global constants in app delegate or singleton

I am converting a non ARC projecs to ARC. I just found that after login in my old app, the data is stored in app delegate objects, like Home_DataArray, various ...
ChenSmile's user avatar
  • 183
1 vote
0 answers
105 views

Functional-style Cocoa XML serializer and object mapper

I'm working on an XML-to-model-object serialization and deserialization library. There are three main design goals for the code: It should parse XML into and serialize from Cocoa-native collection ...
H2CO3's user avatar
  • 115
0 votes
2 answers
2k views

Convert NSInteger into NSString

This is my sample code to convert a integer into string. Is it very costly to do the multiple loops of [NSMutableString stringWithFormat:..]? I.e should I just use appendString and get the NSString ...
Smart Home's user avatar
3 votes
0 answers
117 views

Sesame Street project

I started a tutorial online to get a little bit more knowledge about views. But after I did the basic I decided to finish the game. The game is a little "I spy" game where the user tries to guess the ...
user avatar
2 votes
2 answers
91 views

UIFont expansion

I wanted to expand the UIFont class in my application so I could use the large/medium/small letters concept. I created but for some reason it looks weird. I ...
user avatar
1 vote
1 answer
56 views

Sorting Timestamped Messages (iOS)

An app I'm building professionally includes rudimentary text messaging. It allows users to send from the phone, and it polls for new messages (I know, yikes. Push notifications are a future task) with ...
Chris's user avatar
  • 113
4 votes
1 answer
1k views

NSURLSession load images on demand

I'm trying to come up with a system to populate my item images on demand, this is what I have so far. One obvious bug is that an item image could be downloaded multiple time since the ...
trapper's user avatar
  • 221
6 votes
3 answers
2k views

Bubble Sort in Objective-C

Following is Objective-C method implementation I did for one of the most simplest sorting algorithms, Bubble Sort to sort an array of integers. Note:- I have defined it as a static method in the ...
Randika Vishman's user avatar
3 votes
2 answers
3k views

UIButton Subclass - Overriding getters to return placeholder/default values

I'm in the process of converting a custom UIButton from Objective-C to Swift which has custom properties and default values for those properties: MyButton.h ...
JAL's user avatar
  • 571
2 votes
2 answers
276 views

Method to check if TicTacToe board has a winner

I have a class called TicTacToeBoard that has a [3][3] array of TicTacToeBoardCells. Doc neck if board has a winner, I check if ...
Smart Home's user avatar
4 votes
2 answers
94 views

Given a set of random strings, write a function that returns a set that groups all the anagrams together in objective-c

I would like to get feedback on the solution and a question regarding Big O. I am first converting each character in the string into the array and that would be O(n) then i am sorting the array O(n ...
Yan's user avatar
  • 683
2 votes
2 answers
1k views

Current user as a class-level property in Objective-C and Swift

I was recently tasked with architecting a user/profile object in Objective-C and wanted the ability to access a static instance from the class level, similar in style to the way Parse manages their ...
JAL's user avatar
  • 571
2 votes
1 answer
2k views

Implementing a HashTable in Objective-C

I am trying to implement a hash table in Objective-C. I did some testing and the implementation seems to work. I am using an NSMutableArray to store linked lists ...
Yan's user avatar
  • 683

1
2 3 4 5
8