Questions tagged [cocoa-design-patterns]

Use this tag for questions about design patterns that apply specifically to using the Cocoa and Cocoa-Touch frameworks used in MacOS and iOS development. Examples of such design patterns include, but are not limited to, 'MVC' (model-view-controller), 'delegation', 'observer', 'singleton', 'responder chain', and more. Some of these are well-known patterns but may be used in Cocoa and Cocoa-Touch in more specialised ways.

174 questions
3
votes
1 answer

Cocoa plugin pattern

I have a plugin architecture for my desktop app. I've implemented it in a fairly standard way using Apple's code loading guide. I have a single protocol which defines all the methods an instance of the plugin can or should respond to. The only…
firstresponder
  • 5,000
  • 8
  • 32
  • 38
2
votes
2 answers

Desing pattern for background working app

I have created a web-service app and i want to populate my view controllers according to the response i fetch(via GET) in main thread. But i want to create a scheduled timer which will go and control my server, if there becomes any difference(let's…
ilhnctn
  • 2,210
  • 3
  • 23
  • 41
2
votes
1 answer

What should be the superclass of my new controller?

I'm the developer of an in-house program for modeling harmonics and other properties of liquid-filled shells. Right now, the whole program assumes that there's only one set of physical properties (temperature, pressure, etc.) being used at a time in…
SSteve
  • 10,550
  • 5
  • 46
  • 72
2
votes
2 answers

How to create a calendar in Iphone Application?

I had developed a website application which consists a calendar used to record member's events. So, I need to develop an Iphone Application. For example, this Iphone Application consists of 4 tabs, when click on one tab, it will show a calendar…
cthesky
  • 41
  • 1
  • 1
  • 3
2
votes
2 answers

What's the problem with using singleton in an app that use a lot of HTTP request?

I have a singleton class that basically interface all my HTTP requests. So it pretty much looks like this: Server <--> Singleton <---> view controllers --> views Is it bad? Why do people tell me that singleton breaks modularity? I think it's a good…
Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
2
votes
2 answers

Implementing an iPhone App within an App

I have two apps, I want to merge them, by bringing the smaller app in to the main application, such that instead of the smaller app originally being instantiated from it's App Delegate, is instead pushed via the existing navigation controller of the…
David van Dugteren
  • 3,879
  • 9
  • 33
  • 48
2
votes
2 answers

What is Dynamic Creation?

I recently read about Dynamic Creation as one of the design pattern in Cocoa. However, I don't really understand how it works. So I need clarification from you who have implemented in your design. What is it? Why and when would you use this design…
sayzlim
  • 275
  • 1
  • 2
  • 16
2
votes
0 answers

Nib file (and code) organization in a one-window, non-document-based app

Good people of StackOverflow, I am in the early stages of building a non-document-based Cocoa application. What I'm aiming for is a window layout similar to iTunes, with a left, middle, and right pane. The Xcode template for such an application…
alexantd
  • 3,543
  • 3
  • 27
  • 41
2
votes
2 answers

Real scenario for implementation of MVC vs MVVM vs VIPER for iOS based projects

Can anybody explain the real scenario for implementation of MVC vs MVVM vs VIPER for iOS based project.I'm looking some example which explain that where we should use MVC,MVVM and VIPER. Thanks in advance.
2
votes
2 answers
2
votes
2 answers

Do I really need a shared instance on a singleton?

I have written a helper struct for saving and loading stuff to NSUserDefaults. import UIKit struct Database { static let defaults = NSUserDefaults.standardUserDefaults() static var myVariable: AnyObject? static func save() { …
MJQZ1347
  • 2,607
  • 7
  • 27
  • 49
2
votes
1 answer

Recommended document structure. File Wrappers? Roll my own?

I'm currently working out the best structure for a document I'm trying to create. The document is basically a core data document that uses sqlite as its store, but uses the Apple provided NSPersistentDocument+FileWrapperSupport to enable file…
Tricky
  • 7,025
  • 5
  • 33
  • 43
2
votes
2 answers

iOS Design Pattern Implementation

I'm struggling with design patterns and would like to follow best practices while rewriting my current app from Objective-C to Swift. I have a game where a player gets extra scores/or special prizes for, let's say, solving a certain amount of…
autobot
  • 139
  • 9
2
votes
2 answers

Which pattern should be used for editing properties with modal view controller on iPhone?

I am looking for a good pattern for performing basic property editing via a modal view on the iPhone. Assume I am putting together an application that works like the Contacts application. The "detail" view controller displays all of the contact's…
2
votes
2 answers

Is it worthwhile to implement observer pattern in PHP?

I have been meaning to make use of design pattern in PHP, such as the observer pattern, but that I have to recreate the observers' relationship each time the page is loaded pains me. As references are saved as a new concrete objects in session,…
Extrakun
  • 19,057
  • 21
  • 82
  • 129