Is optional or required the default for protocol methods?

I used to think that the default/implicit specifier for protocol methods is optional. However, in my current project I see a warning if I do not add the @optional specifier specifically. Not a big deal. I am just wondering, was it optional the defaul

iOS Delegates instead of transmitting data via a segment

I'm trying to learn how delegates work and wrap my head around the concept. I'm finding I get some of the ideas. I understand you use it to pass data from one view controller to another, however wouldn't it work the same if I just sent data from a se

Delegate called several times from the asynchronous WCF method

In a client application, I am using an asynchronous WCF method being called from the following code: public void doActiveDx() { this.dataservice.GetActiveDxCompleted += (s,e) => { ...do something... }; this.dataservice.GetActiveDxAsync( ); } Why is t

Generic contravariance delegate compiler error

I'm using the MSDN examples for variance in delegate. But the following code is giving me a compilation error. Based on my understanding, it should accept the First as an argument. What am I doing wrong? The code sample. SampleGenericDelegate<Second,

The iOS delegate is not called

For a project I need to be able to send a status back from "secondTableViewController" to "firstTableViewController". I followed some tutorials on delegates but I don't seem to get it to work. When I want to call the method in firstTab

Default value for the delegate dictionary template

Consider this code: switch (number) { case 1: Number = (int)SmsStatusEnum.Sent; break; case 2: Number = (int)SmsStatusEnum.Delivered; break; case 3: Number = (int)SmsStatusEnum.Failed; break; default: Number = (int)SmsStatusEnum.Failed; break; } retu

set the view of the table in the View controller

Here's my problem. I created a view controller and I inserted a table view(with a cell) in it. I have also a text field at the bottom of the view controller. The aim is to put in the cell the text I wrote in the text field. I tried a lot of things bu

Generic case to react to changes in model value

I am writing a networked application. My model objects contain delegates that are called when a value changes. I have network objects that use the delegates to send the changed value over the network: Model: public class Person : AbstractModel { publ

Objective-C protocols do not send messages

I have read around, and it seems as though delegates would be really useful in my app. Unfortunately, every tutorial about protocols I have tried has failed - the delegate is not receiving the message! It would be great if someone could tell me what

Function pointer translation from C ++ to C #

I was translating some C++ code to C# and there was a function pointer within a structure definition, say func* This func* was a pointer to a lot of other function pointers all contained within a C++ header file (This header file won't be translated)

How to set Func Callback inside the call method?

I would like to declare / define my delegate and callback function inside of the calling method. Is that possible ? If yes how ? This is my code that I want to execute my first implant operation on: delegate bool myDelegate(IntPtr module, string type

Weird memory issues, with ARC enabled

I am having a very, very strange error, probably related to memory management (even though I'm using ARC). I have a my AppDelegate, Foo, and SubFoo (which is a subclass of Foo). Foo.h @protocol FooDelegate <NSObject> - (void)didReceiveDownloadReques

Why do two delegated instances return the same code?

Take the following: var x = new Action(() => { Console.Write("") ; }); var y = new Action(() => { }); var a = x.GetHashCode(); var b = y.GetHashCode(); Console.WriteLine(a == b); Console.WriteLine(x == y); This will print: True False Why i

jquery ui autocomplete with a delegate

I have set up JQuery UI autocomplete according to the docs and it works for any input with class="tag-item" that is rendered to the page. However the user can add inputs into the dom via JS so I need a way to bind autocomplete to the new dynamic

Active registration with delegate and conditions

Is it possible to use delegate in your Active Record model and use conditions like :if on it? class User < ApplicationRecord delegate :company, :to => :master, :if => :has_master? belongs_to :master, :class_name => "User" def has_mas

transition from vacuum to a generic class

I'm trying to create a form that will animate something while processing a particular task (passed as a delegate to the constructor). It's working fine, but the problem I'm having is that I can't instantiate a copy of my generic class if the particul

How do you declare a predicate delegate online?

I'm using C#. So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List<MyObject> myObjects = new List<MyObject>(); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myO