dugla
dugla

Reputation: 12954

How Do I Implement Plug-Ins in Obj-C/CocoaTouch

I need a simple, lightweight, approach to support a plug-in system in an iOS app I am writing. Nothing fancy. This will not be exposed to the user but rather is a productivity aid for my development of roughly 100 small (~50 lines of code) modules of code that I allow the user to select from.

I currently am leaning heavily on a plist/NSDictionary approach with a category on NSDictionary to additional functionality. The plist is a dictionary of settings specific to functionality that a corresponding plug-in with communicate with. I now want to add the plug-in name as a target/action pair. This is where I am a bit unsure of the best approach. How to I specify this target/action pair? Clearly I don't want 100 subclasses. Perhaps a protocol/delegate design?

Thanks, Doug

Upvotes: 0

Views: 61

Answers (1)

Rich
Rich

Reputation: 1090

Invocations and operations are your friend. If you make a custom operation that is passed logic data it can either use invocations or directly call the modules. With this approach you can add numerous operations to the queue.

Upvotes: 1

Related Questions