class-extensions Questions

4

Solved

I have been trying refactor code by thanking functions and adding them in a separate file extension of a ViewController What I have in this extension is a function that adds gesture recognizers t...
Almaalmaata asked 23/10, 2018 at 9:50

6

Solved

I'm slowly building my personal website over at dlblack.dev, and I'm trying to spice it up a little bit. For example, from a computer (rather than a tablet or phone since they don't have mouse poin...

4

I'm using a third-party library for a new app that I'm making using Swift. The author of the class/library has made it final using the final keyword, probably to optimise and to prevent overriding ...
Willodeanwilloughby asked 5/11, 2015 at 8:21

2

I'd like to add some functions to the Array class (I'd rather not have them as functions external to the class since it would ideally be discoverable when typing . following the object). This is wh...
Arraignment asked 4/2, 2019 at 19:21

2

Solved

Is there anyhow anyway to add some static method to types like Date, String, Array, etc? For example I want to add method today to Date class and in JavaScript I can simply add a property to it or...
Cq asked 10/10, 2017 at 10:43

1

Solved

Is it possible to dynamically extend a class object in PHP? And what would be the most elegant way of doing this? Some example code for further explanation: class BasicClass { private $variable...
Arbuckle asked 20/2, 2018 at 11:12

1

Solved

The following is a code snippet which deals with class extensions. What I am trying to do is generate a random ID called internal ID (that is used by the program later on) which is stored in an enc...
Vasti asked 19/3, 2017 at 2:57

2

Solved

I'am using a third-party framework that provides a class whose instances only have properties. In my app, I'd like to add an extra property to this instances. What the appropriate way to do this wo...
Coachandfour asked 8/8, 2016 at 10:50

4

Solved

Class extensions @interface Class () are a lot more powerful and can inject variables into the class. Categories @interface Class (Category) can't. What other differences are there, and when shou...
Socket asked 21/8, 2011 at 3:23

2

I don't understand why programmers use the extension keyword in their class implementation. You can read in other topics that code is then more semantically separated and etc. But when I work with ...
Entrechat asked 6/2, 2015 at 14:27

2

Solved

See this similar question: Need access more user properties in User.Identity I would like to create custom authentication methods to use with my Razor Views that allows easy access IdentityUser pro...

2

Solved

I'm writing a library, which will potentially be used by people that aren't me. Let's say I write a class: InterestingClass.h @interface InterestingClass: NSObject - (id)initWithIdentifier:(NSSt...
Gwendolyn asked 31/1, 2013 at 14:10

5

Solved

As a fairly new objective-c programmer (with a 4 years Java experience), I seem to be having a hard time understanding when to use class extensions. From what I understood (and please, correct me i...
Sandrasandro asked 3/2, 2013 at 17:33

1

Solved

Say I have 2 classes: Money and Dollar, where Dollar inherits from Money. Money has a property declared in a class extension: #import "Money.h" @interface Money () @property(nonatomic) NSUIntege...

4

Solved

I have the following class interface: @interface MyClass : NSObject @property int publicProperty; @end then the implementation: @interface MyClass() // class extension - (void)privateMethod;...
Something asked 3/7, 2012 at 4:9

3

Solved

I've been declaring private methods in class extensions, according to Best way to define private methods for a class in Objective-C. But, I just realized that, in Xcode 4, if I leave out the decla...
Chemush asked 20/7, 2011 at 19:5

4

Solved

I've been looking at Apple's MVCNetworking example project and part of the interface definition for AppDelegate is puzzling me. In the .h file we have this: @interface AppDelegate : NSObject { .....
Pindling asked 22/11, 2011 at 20:40

2

Solved

I believe a popular way to declare "private methods" in Objective-C is to create its class extension and declare methods that you would like to make as private. I would like to know more in detail...

2

Solved

Would it make any sense to put class extensions in their own .h files and #import them selectively to get various levels of visibility for a class' methods and properties? If this is a bad idea (or...
Linus asked 18/8, 2011 at 16:4

2

Solved

There are several situations where you might override a super class's property. You declare a property with the same name and same attribute of its superclass'.(since if you change the attribute ...
Horseleech asked 13/4, 2011 at 14:28
1

© 2022 - 2024 — McMap. All rights reserved.