Xcode 10.2 Swift Error: Function types cannot be represented in Objective-C unless their parameters and returns can beHow do you document the parameters of a function's closure parameter in Swift 3?Swift to Objective-C header not created in Xcode 6How can method in Swift with inout parameter be used in Objective-C?Protocol with associatedtype doesn't play nice with optionalSwift 2.0 Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-CExpose swift variadic parameter to Objective-CUnable to convert Swift protocol in Objective-C || How to write 'Self' return type of a protocol method of Swift in Objective-CMethod cannot be marked @objc because the type of the parameter 2 cannot be represented in Objective-CMethod cannot be marked @objc because its result type cannot be represented in Objective-CCannot access Swift Framework in Objective-Cfunc in swift for “self” causes error in Xcode
Is there a booking app or site that lets you specify your gender for shared dormitories?
How to prevent Deadlock on SELECT queries?
What does "autolyco-sentimental" mean?
How to open Lightning component in new window
How do I show and not tell a backstory?
What is the difference between "un plan" and "une carte" (in the context of map)?
Repeated! Factorials!
Is there a command-line tool for converting html files to pdf?
Can the Cauchy product of divergent series with itself be convergent?
Did Logical Positivism fail because it simply denied human emotion?
How to win against ants
Can attackers change the public key of certificate during the SSL handshake
Awk to get all my regular users in shadow
…down the primrose path
The warlock of firetop mountain, what's the deal with reference 192?
Why is Heisenberg shown dead in Negro y Azul?
Are valid inequalities worth the effort given modern solver preprocessing options?
Broken bottom bracket?
Is it uncompelling to continue the story with lower stakes?
Which one is more important between endgame studies and tactics?
Why is it to say 'paucis post diebus'?
What are the limitations of the Hendersson-Hasselbalch equation?
“The Fourier transform cannot measure two phases at the same frequency.” Why not?
What does Argus Filch specifically do?
Xcode 10.2 Swift Error: Function types cannot be represented in Objective-C unless their parameters and returns can be
How do you document the parameters of a function's closure parameter in Swift 3?Swift to Objective-C header not created in Xcode 6How can method in Swift with inout parameter be used in Objective-C?Protocol with associatedtype doesn't play nice with optionalSwift 2.0 Method cannot be marked @objc because the type of the parameter cannot be represented in Objective-CExpose swift variadic parameter to Objective-CUnable to convert Swift protocol in Objective-C || How to write 'Self' return type of a protocol method of Swift in Objective-CMethod cannot be marked @objc because the type of the parameter 2 cannot be represented in Objective-CMethod cannot be marked @objc because its result type cannot be represented in Objective-CCannot access Swift Framework in Objective-Cfunc in swift for “self” causes error in Xcode
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I updated Xcode to 10.2 today and I got the following errors:
Method cannot be marked @objc because the type of the parameter 2
cannot be represented in Objective-C
Function types cannot be represented in Objective-C unless their parameters and returns can be
I don't understand why
It was perfectly fine in 10.1.
This is an example that I have been using for years without any issues.
How can I make this code to compile without errors?
@objc public func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void)
// do stuff
objective-c swift xcode xcode10.2
|
show 2 more comments
I updated Xcode to 10.2 today and I got the following errors:
Method cannot be marked @objc because the type of the parameter 2
cannot be represented in Objective-C
Function types cannot be represented in Objective-C unless their parameters and returns can be
I don't understand why
It was perfectly fine in 10.1.
This is an example that I have been using for years without any issues.
How can I make this code to compile without errors?
@objc public func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void)
// do stuff
objective-c swift xcode xcode10.2
1
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
2
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.
– Martin R
Mar 27 at 12:59
|
show 2 more comments
I updated Xcode to 10.2 today and I got the following errors:
Method cannot be marked @objc because the type of the parameter 2
cannot be represented in Objective-C
Function types cannot be represented in Objective-C unless their parameters and returns can be
I don't understand why
It was perfectly fine in 10.1.
This is an example that I have been using for years without any issues.
How can I make this code to compile without errors?
@objc public func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void)
// do stuff
objective-c swift xcode xcode10.2
I updated Xcode to 10.2 today and I got the following errors:
Method cannot be marked @objc because the type of the parameter 2
cannot be represented in Objective-C
Function types cannot be represented in Objective-C unless their parameters and returns can be
I don't understand why
It was perfectly fine in 10.1.
This is an example that I have been using for years without any issues.
How can I make this code to compile without errors?
@objc public func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void)
// do stuff
objective-c swift xcode xcode10.2
objective-c swift xcode xcode10.2
edited Mar 27 at 12:48
Tibidabo
asked Mar 27 at 2:38
TibidaboTibidabo
19.6k4 gold badges81 silver badges82 bronze badges
19.6k4 gold badges81 silver badges82 bronze badges
1
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
2
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.
– Martin R
Mar 27 at 12:59
|
show 2 more comments
1
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
2
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.
– Martin R
Mar 27 at 12:59
1
1
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
2
2
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:
handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.– Martin R
Mar 27 at 12:59
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:
handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.– Martin R
Mar 27 at 12:59
|
show 2 more comments
1 Answer
1
active
oldest
votes
Delete the phrase outPut:
. It was always illegal; Swift 5 just tightens up at last.
So:
@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
@Tibidabo: You can define the parameter ashandler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.
– Martin R
Mar 27 at 3:01
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%2f55368967%2fxcode-10-2-swift-error-function-types-cannot-be-represented-in-objective-c-unle%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
Delete the phrase outPut:
. It was always illegal; Swift 5 just tightens up at last.
So:
@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
@Tibidabo: You can define the parameter ashandler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.
– Martin R
Mar 27 at 3:01
add a comment |
Delete the phrase outPut:
. It was always illegal; Swift 5 just tightens up at last.
So:
@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
@Tibidabo: You can define the parameter ashandler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.
– Martin R
Mar 27 at 3:01
add a comment |
Delete the phrase outPut:
. It was always illegal; Swift 5 just tightens up at last.
So:
@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {
Delete the phrase outPut:
. It was always illegal; Swift 5 just tightens up at last.
So:
@objc public func myFunction(inputString: String, handler:@escaping (NSArray) -> Void) {
answered Mar 27 at 2:40
mattmatt
352k53 gold badges576 silver badges769 bronze badges
352k53 gold badges576 silver badges769 bronze badges
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
@Tibidabo: You can define the parameter ashandler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.
– Martin R
Mar 27 at 3:01
add a comment |
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
@Tibidabo: You can define the parameter ashandler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.
– Martin R
Mar 27 at 3:01
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
You should not be using NSArray either but that’s a different issue.
– matt
Mar 27 at 2:43
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
Thank you Matt. It did the trick. Is there any way to assign phrases to the variables that is not illegal?
– Tibidabo
Mar 27 at 2:57
2
2
@Tibidabo: You can define the parameter as
handler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.– Martin R
Mar 27 at 3:01
@Tibidabo: You can define the parameter as
handler: @escaping (_ output: NSArray) -> Void
. That also allows to document the parameter, see stackoverflow.com/a/38669796/1187415.– Martin R
Mar 27 at 3:01
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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%2f55368967%2fxcode-10-2-swift-error-function-types-cannot-be-represented-in-objective-c-unle%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
1
Is that a member function of a class? – My Xcode 10.2 complains “Cannot create a single-element tuple with an element label” with the Fix-it “Replace 'outPut: ' with ''”
– Martin R
Mar 27 at 2:43
@MartinR I removed the element label and that solved the issue see the answer from matt
– Tibidabo
Mar 27 at 2:59
I know that is does. But if I cannot reproduce the exact error message as reported then I wonder if the exact code was posted :)
– Martin R
Mar 27 at 3:09
@MartinR Sorry, you are right. I simplified it... It should have more than one element in the tuple. it should be: func myFunction(inputString: String, handler:@escaping ((success: Bool, outPut: NSArray)) -> Void) // do stuff
– Tibidabo
Mar 27 at 6:18
2
Now it gets interesting: Your closure argument has an extra pair of parentheses, apparently Swift 4 ignores that but Swift 5 does not. If you remove that extra pair:
handler:@escaping (success: Bool, outPut: NSArray) -> Void
then you'll get a clear error message “Function types cannot have argument labels; use '_' before 'outPut'” already in Swift 4/Xcode 10.1. – So what changed is not the forbidden external parameter names (they are already forbidden in Swift 4), but how the compiler treats the extra pair of parentheses.– Martin R
Mar 27 at 12:59