How to add optional delegates with #if canImport() enabled?How to change the name of an iOS app?How do I create delegates in Objective-C?How can I make a UITextField move up when the keyboard is present - on starting to edit?How to tell if UIViewController's view is visibleWhat kind of leaks does automatic reference counting in Objective-C not prevent or minimize?weak or strong properties for my sub-viewControllers?How to architect 'State Controller' objects being delegates of shared servicesCustom init for UIViewController in Swift with interface setup in storyboardhow to programmatically create segue for use with Protocol & Delegate (swift 3 xcode)Delegate retention circle although using weak
GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?
Machine learning testing data
What Exploit Are These User Agents Trying to Use?
What is the opposite of "eschatology"?
Bullying boss launched a smear campaign and made me unemployable
In the UK, is it possible to get a referendum by a court decision?
Obtaining database information and values in extended properties
When handwriting 黄 (huáng; yellow) is it incorrect to have a disconnected 草 (cǎo; grass) radical on top?
Can I hook these wires up to find the connection to a dead outlet?
Car headlights in a world without electricity
What historical events would have to change in order to make 19th century "steampunk" technology possible?
Standard deduction V. mortgage interest deduction - is it basically only for the rich?
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Should I tell management that I intend to leave due to bad software development practices?
What is an equivalently powerful replacement spell for Yuan-Ti's Suggestion spell?
Why was the shrink from 8″ made only to 5.25″ and not smaller (4″ or less)
What are the G forces leaving Earth orbit?
files created then deleted at every second in tmp directory
Could the museum Saturn V's be refitted for one more flight?
Convert seconds to minutes
How do conventional missiles fly?
Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?
What does the same-ish mean?
Am I breaking OOP practice with this architecture?
How to add optional delegates with #if canImport() enabled?
How to change the name of an iOS app?How do I create delegates in Objective-C?How can I make a UITextField move up when the keyboard is present - on starting to edit?How to tell if UIViewController's view is visibleWhat kind of leaks does automatic reference counting in Objective-C not prevent or minimize?weak or strong properties for my sub-viewControllers?How to architect 'State Controller' objects being delegates of shared servicesCustom init for UIViewController in Swift with interface setup in storyboardhow to programmatically create segue for use with Protocol & Delegate (swift 3 xcode)Delegate retention circle although using weak
how to add optional delegates between #ifCan compiler tags?
Here what I need t do:
#if canImport(optionalFramework)
//adding optional delegate
class ViewController: UIViewController, OptionalDelagate
#else
//no need for delagete
class ViewController: UIViewController
#endif
Such feature if possible would really be crucial and would really improve whole application design.. However, I am getting multiple compiler errors..
I tried to create separate class,which would use this delegate, but I can't remove it, and I am getting memory leaks, because of strong references.
Thanks as always :)
ios swift uiviewcontroller protocols
add a comment |
how to add optional delegates between #ifCan compiler tags?
Here what I need t do:
#if canImport(optionalFramework)
//adding optional delegate
class ViewController: UIViewController, OptionalDelagate
#else
//no need for delagete
class ViewController: UIViewController
#endif
Such feature if possible would really be crucial and would really improve whole application design.. However, I am getting multiple compiler errors..
I tried to create separate class,which would use this delegate, but I can't remove it, and I am getting memory leaks, because of strong references.
Thanks as always :)
ios swift uiviewcontroller protocols
add a comment |
how to add optional delegates between #ifCan compiler tags?
Here what I need t do:
#if canImport(optionalFramework)
//adding optional delegate
class ViewController: UIViewController, OptionalDelagate
#else
//no need for delagete
class ViewController: UIViewController
#endif
Such feature if possible would really be crucial and would really improve whole application design.. However, I am getting multiple compiler errors..
I tried to create separate class,which would use this delegate, but I can't remove it, and I am getting memory leaks, because of strong references.
Thanks as always :)
ios swift uiviewcontroller protocols
how to add optional delegates between #ifCan compiler tags?
Here what I need t do:
#if canImport(optionalFramework)
//adding optional delegate
class ViewController: UIViewController, OptionalDelagate
#else
//no need for delagete
class ViewController: UIViewController
#endif
Such feature if possible would really be crucial and would really improve whole application design.. However, I am getting multiple compiler errors..
I tried to create separate class,which would use this delegate, but I can't remove it, and I am getting memory leaks, because of strong references.
Thanks as always :)
ios swift uiviewcontroller protocols
ios swift uiviewcontroller protocols
edited Mar 7 at 21:03
Viktor Vostrikov
asked Mar 7 at 20:51
Viktor VostrikovViktor Vostrikov
591113
591113
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Move the delegate definition into an extension:
#if canImport(optionalFramework)
extension ViewController: OptionalDelegate
#endif
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052598%2fhow-to-add-optional-delegates-with-if-canimport-enabled%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Move the delegate definition into an extension:
#if canImport(optionalFramework)
extension ViewController: OptionalDelegate
#endif
add a comment |
Move the delegate definition into an extension:
#if canImport(optionalFramework)
extension ViewController: OptionalDelegate
#endif
add a comment |
Move the delegate definition into an extension:
#if canImport(optionalFramework)
extension ViewController: OptionalDelegate
#endif
Move the delegate definition into an extension:
#if canImport(optionalFramework)
extension ViewController: OptionalDelegate
#endif
answered Mar 7 at 21:19
Rob NapierRob Napier
206k28305433
206k28305433
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55052598%2fhow-to-add-optional-delegates-with-if-canimport-enabled%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown