delegates Questions

2

Solved

Consider this simple .js code: const createCounter = () => { let value = 0; return { increment: () => { value += 1 }, decrement: () => { value -= 1 }, logValue: () => { console.lo...
Aba asked 15/8, 2019 at 14:52

10

Solved

I'm writing code like this, doing a little quick and dirty timing: var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < 1000; i++) { b = DoStuff(s); } sw.Stop(); Console.WriteLine(sw.Elap...
Pneumectomy asked 24/10, 2008 at 8:39

1

Solved

I am trying to implement a functionality that requires a delegate method (like NSUserActivity). Therefore I need a UIViewController that conforms to NSUserActivityDelegate (or similar other delegat...
Stooge asked 30/7, 2019 at 23:46

7

Solved

Throughout my app, I'm getting semantic issue warnings when I set ViewController.delegate = self. I have searched and found similar posts but none were able to solve my problem. ViewController.m: ...
Alkalize asked 25/3, 2012 at 15:52

2

I've been working on converting some blueprint logic over to C++. One of the things I have is a button. The button can be pressed in VR and has a delegate that is called to notify any registered fu...
Matheson asked 29/6, 2019 at 22:21

4

Solved

I'm practicing and reading up on SwiftUI and I am starting off by making a simple app where you can type a location into a TextField View from swiftUI and then on enter the mkmapview within SwiftUI...
Troostite asked 6/6, 2019 at 4:16

4

Solved

I'm subclassing UIScrollView to add some features such as double tap to zoom and an image property for gallery purposes. But in order to do the image part my subclass has to be its own delegate and...
Afire asked 16/11, 2014 at 3:52

3

I am trying to create a delegate to a struct method for a particular instance. However, it turns out that a new instance of the struct is created and when I call the delegate it performs the method...
Rolanderolando asked 23/2, 2011 at 2:44

4

Solved

To create a delegate from a method you can use the compile type-safe syntax: private int Method() { ... } // and create the delegate to Method... Func<int> d = Method; A property is a wra...
Roundlet asked 12/4, 2010 at 11:4

3

Solved

I'm trying to pass a delegate type as a type parameter so that I can then use it as a type parameter later on in the code, like so: // Definition private static class Register { public static Fun...
Verdi asked 29/5, 2011 at 11:7

4

Solved

Here's the error when I wrote the line self.MessageTextField.delegate = self: /ChatApp/ViewController.swift:27:42: Cannot assign a value of type 'ViewController' to a value of type 'UITextFieldD...
Helenhelena asked 13/4, 2015 at 12:35

1

Solved

I've built an event system that maintains a dictionary of delegates, adds/removes elements to this dictionary via generic Subscribe/Unsubscribe methods (which each take an Action of type T), and ha...
Chemical asked 11/4, 2019 at 8:8

6

Solved

I have a fundamental question related to Cocoa frameworks design patterns. What's the difference between delegate and data source? Both of them could use @protocols declaration, but some classes ...
Panjandrum asked 9/2, 2010 at 20:1

2

Solved

According to Sergey Ryazanov, his Impossibly Fast C++ Delegates are not comparable: My delegates cannot be compared. Comparison operators are not defined because a delegate doesn't contain a poi...
Mutism asked 6/10, 2009 at 17:14

2

Solved

I have the following setup in C#: public delegate void CallbackDelegate(string message); [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern void setCallback(CallbackDelegat...
Langland asked 30/9, 2016 at 11:56

1

Solved

I have a general question: in the C# code below thread tFour can not be created and the compiler shows me the following error: "Anonymous function converted to a void returning delegate cannot retu...
Cloak asked 22/3, 2019 at 9:46

6

Now that blocks are finally supported for iphone/ipad development, do these completely remove the need for delegates or are delegates still cleaner as a complete interface implementation while bloc...
Chyou asked 3/1, 2011 at 12:27

1

Solved

In Eric Lippert's blog posts about covariance and contravariance or variance for short, and in books such as C# in a Nutshell, it is stated that : If you’re defining a generic delegate type, it...
Shillong asked 28/2, 2019 at 15:56

3

I am working on the following code and trying to show an activity indicator in the view whilst the page is loading.. I tried to implement the WKNavigationDelegate methods but I am failing as noth...
Marzi asked 31/3, 2015 at 15:41

4

Solved

I'm working on a game for the xbox360, using XNA. On the Xbox the garbage collector performs rather badly compared to the one on a PC, so keeping garbage generated to a minimum is vital for a smoot...
Menispermaceous asked 17/10, 2009 at 17:36

2

Solved

Redundant introduction aside, I want to have something like this: let collection : Any<Sequence where .Iterator.Element == String> = ... or let collection : Sequence<where .Iterator.El...
Extraterritorial asked 13/9, 2016 at 11:52

3

Solved

Why it's not possible to do the following : Func<int, int, int> sum = delegate(int x, int y = 20) { return x + y; }; Action<string, DateTime> print = delegate(string message, DateTi...
Contingency asked 3/11, 2013 at 10:11

3

Solved

I need to implement the following pattern in php: class EventSubscriber { private $userCode; public function __construct(&$userCode) { $this->userCode = &$userCode; } public function...
Strage asked 3/1, 2011 at 11:54

2

I have a constructor for B with some default argument depending on other arguments: struct A { int f(); A(const A&) = delete; A(A&& ); // .... }; struct B { B(A a, int n=a.f()) {...
Iodate asked 12/1, 2019 at 9:22

8

I have simple method in my C# app, it picks file from FTP server and parses it and stores the data in DB. I want it to be asynchronous, so that user perform other operations on App, once parsing is...
Erythritol asked 21/7, 2009 at 13:34

© 2022 - 2024 — McMap. All rights reserved.