objective-c-protocol Questions

4

Solved

Can Objective-C protocol be generic? Following this tutorial, I'm basically looking for something like that: @protocol ItemsStore<__covariant ObjectType> <NSObject> -(NSArray <Obj...
Giblets asked 3/2, 2016 at 17:10

5

Solved

I've read that you should try to use @class in your header file instead of #import but this doesn't work when your @class contains a delegate protocol that you're trying to use. MyView.h #import...

2

Solved

Short problem description Can I extend UIView with a category, but have it only work on subclasses that implement a specific protocol (WritableView)? I.e. can I do something like the following? ...
Brander asked 19/7, 2013 at 6:38

1

Solved

I have an Objective-C protocol which I'm trying to implement in a Swift class. For example: @class AnObjcClass; @protocol ObjcProtocol <NSObject> - (void)somethingWithAnArgument:(AnObjcCla...
Noncompliance asked 2/10, 2015 at 20:37

1

Solved

I've been learning Swift lately. I decided to write a hybrid Swift/Objective-C app that did compute-intensive tasks using the same algorithm implemented in both languages. The program calculates ...

3

Solved

There is an -[NSObject conformsToProtocol:] method to check whether a specific protocol is adopted or not. Is there any method to get all adopted protocols for a class, rather than checking a list?...

1

I'm trying to implement a category for a UIViewController and I want to be certain that the object conforms to a certain protocol. Something like this: #import <UIKit/UIKit.h> @interf...
Pilgrim asked 22/5, 2013 at 2:4

7

Solved

Can anyone explain the differences between Protocols and Categories in Objective-C? When do you use one over the other?
Babylon asked 11/12, 2008 at 21:22
1

© 2022 - 2024 — McMap. All rights reserved.