Delegate methods in child class sometimes not called with Swift 5 compilercollectionView didSelectItemAtIndexPath stopped working after migrated to Xcode 10.2Protocol methods in a class extension are not called under specific conditionsHow do I call Objective-C code from Swift?Why is Swift compile time so slow?Xcode 6.3 Crashes when navigating from storyboard to other Swift 1.2 fileMultiple delegates for UITableView in swiftDelegate methods are not called (transitioningDelegate)How can I can a vertical ScrollView with two horizontal ScrollViews?My horizontal scrollview is not workingCan't build macOS project after updating to Xcode 10.2/Swift 5Odd Generics & Optional Behavior in Swift 4.2 after upgrading to iOS 12.2 (Xcode 10.2)Module compiled with Swift 5.0 cannot be imported by the Swift 4.2.1 compiler
How to circle together certain entries of a matrix?
Are programming languages necessary/useful for operations research practitioner?
Procedure for traffic not in sight
What is negative current?
Random point on a sphere
What was the first LISP compiler?
Where does the expression "triple-A" comes from?
Creating a Master Image to roll out to 30 new Machines Licensing Issues
Do Milankovitch Cycles fully explain climate change?
Can a magnet rip protons from a nucleus?
How to create a list of dictionaries from a dictionary with lists of different lengths
RP Automatic Updates
Why was "leaping into the river" a valid trial outcome to prove one's innocence?
How to split a string by the third .(dot) delimiter
How would two worlds first establish an exchange rate between their currencies
Are there take-over requests from autopilots?
Is English tonal for some words, like "permit"?
Why would thermal imaging be used to locate the Chandrayaan-2 lander?
Why didn't Thor use the All powerful spear instead of Stormbreaker?
Job offer without any details but asking me to withdraw other applications - is it normal?
Is there a standard terminology for female equivalents of terms such as 'Kingdom' and if so, what are the most common terms?
Starring Samurais - Several Scribbled Short Stories
Will replacing a fake visa with a different fake visa cause me problems when applying for a legal study permit?
A medieval fantasy adventurer lights a torch in a 100% pure oxygen room. What happens?
Delegate methods in child class sometimes not called with Swift 5 compiler
collectionView didSelectItemAtIndexPath stopped working after migrated to Xcode 10.2Protocol methods in a class extension are not called under specific conditionsHow do I call Objective-C code from Swift?Why is Swift compile time so slow?Xcode 6.3 Crashes when navigating from storyboard to other Swift 1.2 fileMultiple delegates for UITableView in swiftDelegate methods are not called (transitioningDelegate)How can I can a vertical ScrollView with two horizontal ScrollViews?My horizontal scrollview is not workingCan't build macOS project after updating to Xcode 10.2/Swift 5Odd Generics & Optional Behavior in Swift 4.2 after upgrading to iOS 12.2 (Xcode 10.2)Module compiled with Swift 5.0 cannot be imported by the Swift 4.2.1 compiler
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've seen a lot of weird behaviour after updating Xcode 10.1 to Xcode 10.2, both with Swift 4 and Swift 5 codebases.
One of the problems is that on one ViewController the ScrollView delegate methods are no longer called. The simplified view hierarchy is as follows:
| ScrollView (ParentScrollView)
| -- Stack View
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
It acts as a view with several pages: ParentScrollView
can be scrolled horizontally, the ChildScrollView
s vertically.
The ViewController is the delegate of all Scrollviews (set in Storyboard), but the delegate methods (like scrollViewDidEndDecelerating
) are not called when scrolling any of the views (ParentScrollView or ChildScrollView). The base class of ViewController
conforms to UIScrollViewDelegate
.
I have tried setting the delegates in code, other than that I have no idea what I could be doing wrong. The conversion did not change any code in the class, but everything worked well before updating. I also couldn't find any changes to gestures, delegates or ScrollViews in general in the Swift 5 Release Notes.
This seems to be a bug with the Swift 5 compiler. Additionally, sometimes it does work, sometimes it doesn't - all without changing any code or project settings.
Why does this no longer work? Has anyone else experienced similar behaviour?
swift xcode swift5
add a comment |
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've seen a lot of weird behaviour after updating Xcode 10.1 to Xcode 10.2, both with Swift 4 and Swift 5 codebases.
One of the problems is that on one ViewController the ScrollView delegate methods are no longer called. The simplified view hierarchy is as follows:
| ScrollView (ParentScrollView)
| -- Stack View
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
It acts as a view with several pages: ParentScrollView
can be scrolled horizontally, the ChildScrollView
s vertically.
The ViewController is the delegate of all Scrollviews (set in Storyboard), but the delegate methods (like scrollViewDidEndDecelerating
) are not called when scrolling any of the views (ParentScrollView or ChildScrollView). The base class of ViewController
conforms to UIScrollViewDelegate
.
I have tried setting the delegates in code, other than that I have no idea what I could be doing wrong. The conversion did not change any code in the class, but everything worked well before updating. I also couldn't find any changes to gestures, delegates or ScrollViews in general in the Swift 5 Release Notes.
This seems to be a bug with the Swift 5 compiler. Additionally, sometimes it does work, sometimes it doesn't - all without changing any code or project settings.
Why does this no longer work? Has anyone else experienced similar behaviour?
swift xcode swift5
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
5
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17
add a comment |
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've seen a lot of weird behaviour after updating Xcode 10.1 to Xcode 10.2, both with Swift 4 and Swift 5 codebases.
One of the problems is that on one ViewController the ScrollView delegate methods are no longer called. The simplified view hierarchy is as follows:
| ScrollView (ParentScrollView)
| -- Stack View
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
It acts as a view with several pages: ParentScrollView
can be scrolled horizontally, the ChildScrollView
s vertically.
The ViewController is the delegate of all Scrollviews (set in Storyboard), but the delegate methods (like scrollViewDidEndDecelerating
) are not called when scrolling any of the views (ParentScrollView or ChildScrollView). The base class of ViewController
conforms to UIScrollViewDelegate
.
I have tried setting the delegates in code, other than that I have no idea what I could be doing wrong. The conversion did not change any code in the class, but everything worked well before updating. I also couldn't find any changes to gestures, delegates or ScrollViews in general in the Swift 5 Release Notes.
This seems to be a bug with the Swift 5 compiler. Additionally, sometimes it does work, sometimes it doesn't - all without changing any code or project settings.
Why does this no longer work? Has anyone else experienced similar behaviour?
swift xcode swift5
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've seen a lot of weird behaviour after updating Xcode 10.1 to Xcode 10.2, both with Swift 4 and Swift 5 codebases.
One of the problems is that on one ViewController the ScrollView delegate methods are no longer called. The simplified view hierarchy is as follows:
| ScrollView (ParentScrollView)
| -- Stack View
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
| ---- ScrollView (ChildScrollView)
It acts as a view with several pages: ParentScrollView
can be scrolled horizontally, the ChildScrollView
s vertically.
The ViewController is the delegate of all Scrollviews (set in Storyboard), but the delegate methods (like scrollViewDidEndDecelerating
) are not called when scrolling any of the views (ParentScrollView or ChildScrollView). The base class of ViewController
conforms to UIScrollViewDelegate
.
I have tried setting the delegates in code, other than that I have no idea what I could be doing wrong. The conversion did not change any code in the class, but everything worked well before updating. I also couldn't find any changes to gestures, delegates or ScrollViews in general in the Swift 5 Release Notes.
This seems to be a bug with the Swift 5 compiler. Additionally, sometimes it does work, sometimes it doesn't - all without changing any code or project settings.
Why does this no longer work? Has anyone else experienced similar behaviour?
swift xcode swift5
swift xcode swift5
edited May 29 at 11:21
Jan Schlorf
asked Mar 28 at 8:26
Jan SchlorfJan Schlorf
8089 silver badges25 bronze badges
8089 silver badges25 bronze badges
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
5
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17
add a comment |
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
5
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
5
5
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17
add a comment |
6 Answers
6
active
oldest
votes
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've found the issue, here's how to reproduce it.
class A: UIViewController, UIScrollViewDelegate
// ...does not implement 'scrollViewDidEndDecelerating'
class B: A
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will not be called!
What does work:
class A: UIViewController, UIScrollViewDelegate
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Probably empty
class B: A
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will be called!
The compiler seems to think that a delegate method is not implemented if the base class did not implement it. If only the child class implements it, it can't find it.
I still can't explain why this behaviour changed with Swift 5, but at least I've found a solution. Maybe someone can give further insights?
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
|
show 4 more comments
Looks like this issue existed back in 2016 as well and was fixed at one point: https://bugs.swift.org/browse/SR-2919
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
add a comment |
As Jan pointed out, this is a Swift 5 regression. This is tracked on Swift's JIRA as well as on radar (rdar://problem/49482328). This is also already fixed (PR here) but we need to wait for the next Xcode/Swift release.
Edit: As of Xcode 10.3, we observed that the bug is fixed, but we are still monitoring if it is fixed for good.
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
add a comment |
We ran into this with a UITextViewDelegate
Another workaround is to add the @objc
tag to the method in the superclass
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
add a comment |
I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.
For those who don't want to add @objc everywhere in your delegate implementation.
The quick solution is to disable the Swift 5 compiler optimisation in the build settings:
For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward.SWIFT_COMPILATION_MODE = singlefile;
add a comment |
Since all of UIScrollViewDelegate
methods are optionals you will never see an error from compiler if it thinks that you didn't implement them, most probably what is happening is that Apple changed method signature in Swift 5 (again) and for some reason the migration tool didn't work.
Check the methods names along with UIScrollViewDelegate
updated to USwift 5 documentation, you will see that probably your methods names are different, simply correct them and everything should work again.
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
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/4.0/"u003ecc by-sa 4.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%2f55393027%2fdelegate-methods-in-child-class-sometimes-not-called-with-swift-5-compiler%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've found the issue, here's how to reproduce it.
class A: UIViewController, UIScrollViewDelegate
// ...does not implement 'scrollViewDidEndDecelerating'
class B: A
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will not be called!
What does work:
class A: UIViewController, UIScrollViewDelegate
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Probably empty
class B: A
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will be called!
The compiler seems to think that a delegate method is not implemented if the base class did not implement it. If only the child class implements it, it can't find it.
I still can't explain why this behaviour changed with Swift 5, but at least I've found a solution. Maybe someone can give further insights?
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
|
show 4 more comments
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've found the issue, here's how to reproduce it.
class A: UIViewController, UIScrollViewDelegate
// ...does not implement 'scrollViewDidEndDecelerating'
class B: A
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will not be called!
What does work:
class A: UIViewController, UIScrollViewDelegate
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Probably empty
class B: A
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will be called!
The compiler seems to think that a delegate method is not implemented if the base class did not implement it. If only the child class implements it, it can't find it.
I still can't explain why this behaviour changed with Swift 5, but at least I've found a solution. Maybe someone can give further insights?
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
|
show 4 more comments
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've found the issue, here's how to reproduce it.
class A: UIViewController, UIScrollViewDelegate
// ...does not implement 'scrollViewDidEndDecelerating'
class B: A
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will not be called!
What does work:
class A: UIViewController, UIScrollViewDelegate
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Probably empty
class B: A
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will be called!
The compiler seems to think that a delegate method is not implemented if the base class did not implement it. If only the child class implements it, it can't find it.
I still can't explain why this behaviour changed with Swift 5, but at least I've found a solution. Maybe someone can give further insights?
EDIT: As sunshinejr pointed out here, this has been fixed and will be released together with the next Xcode/Swift version.
I've found the issue, here's how to reproduce it.
class A: UIViewController, UIScrollViewDelegate
// ...does not implement 'scrollViewDidEndDecelerating'
class B: A
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will not be called!
What does work:
class A: UIViewController, UIScrollViewDelegate
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Probably empty
class B: A
override func scrollViewDidEndDecelerating(_ scrollView: UIScrollView)
// Will be called!
The compiler seems to think that a delegate method is not implemented if the base class did not implement it. If only the child class implements it, it can't find it.
I still can't explain why this behaviour changed with Swift 5, but at least I've found a solution. Maybe someone can give further insights?
edited May 29 at 11:22
answered Mar 28 at 9:18
Jan SchlorfJan Schlorf
8089 silver badges25 bronze badges
8089 silver badges25 bronze badges
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
|
show 4 more comments
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
5
5
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
I can confirm this is the issue. It caused breaking bugs in our app as well as we upgraded yesterday.
– Claus Jørgensen
Apr 2 at 11:17
4
4
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
This Swift 5 compiler bug applies potentially to all delegate methods not implemented in an associated base class. To make things even worse, this bug sometimes manifests itself only in Release builds.
– Ely
Apr 10 at 21:49
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@ClausJørgensen Have you found a solution by now? I'm now building with the previous version of Xcode, since trying to find all the possible error cases in our project is simply too risky.
– Jan Schlorf
Apr 11 at 5:39
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
@JanSchlorf your solution works just fine. And if you think about how Objective-C selectors work, it kinda make sense this bug could happen.
– Claus Jørgensen
Apr 11 at 10:29
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
Someone please file a radar (developer.apple.com/bug-reporting) and link it here!
– Andrew Paul Simmons
Apr 12 at 17:42
|
show 4 more comments
Looks like this issue existed back in 2016 as well and was fixed at one point: https://bugs.swift.org/browse/SR-2919
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
add a comment |
Looks like this issue existed back in 2016 as well and was fixed at one point: https://bugs.swift.org/browse/SR-2919
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
add a comment |
Looks like this issue existed back in 2016 as well and was fixed at one point: https://bugs.swift.org/browse/SR-2919
Looks like this issue existed back in 2016 as well and was fixed at one point: https://bugs.swift.org/browse/SR-2919
answered Apr 17 at 17:31
eitoeito
312 bronze badges
312 bronze badges
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
add a comment |
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
I took the time to go in there, make an account and reopen it. Give it some upvotes so it gets attention. It's a pretty serious issue to have in a production ready compiler.
– Fernando Mazzon
Apr 25 at 17:14
add a comment |
As Jan pointed out, this is a Swift 5 regression. This is tracked on Swift's JIRA as well as on radar (rdar://problem/49482328). This is also already fixed (PR here) but we need to wait for the next Xcode/Swift release.
Edit: As of Xcode 10.3, we observed that the bug is fixed, but we are still monitoring if it is fixed for good.
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
add a comment |
As Jan pointed out, this is a Swift 5 regression. This is tracked on Swift's JIRA as well as on radar (rdar://problem/49482328). This is also already fixed (PR here) but we need to wait for the next Xcode/Swift release.
Edit: As of Xcode 10.3, we observed that the bug is fixed, but we are still monitoring if it is fixed for good.
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
add a comment |
As Jan pointed out, this is a Swift 5 regression. This is tracked on Swift's JIRA as well as on radar (rdar://problem/49482328). This is also already fixed (PR here) but we need to wait for the next Xcode/Swift release.
Edit: As of Xcode 10.3, we observed that the bug is fixed, but we are still monitoring if it is fixed for good.
As Jan pointed out, this is a Swift 5 regression. This is tracked on Swift's JIRA as well as on radar (rdar://problem/49482328). This is also already fixed (PR here) but we need to wait for the next Xcode/Swift release.
Edit: As of Xcode 10.3, we observed that the bug is fixed, but we are still monitoring if it is fixed for good.
edited Jul 29 at 18:45
answered May 29 at 10:18
sunshinejrsunshinejr
4,3652 gold badges17 silver badges29 bronze badges
4,3652 gold badges17 silver badges29 bronze badges
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
add a comment |
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
I had the exact same problem with xcode 10.3!
– Gomino
Jul 29 at 19:56
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
The mentioned PR says it's going to release of Swift 5.1, which should be shipped with Xcode 11 (Beta), not 10.3.
– Eugene Berdnikov
Sep 1 at 23:33
add a comment |
We ran into this with a UITextViewDelegate
Another workaround is to add the @objc
tag to the method in the superclass
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
add a comment |
We ran into this with a UITextViewDelegate
Another workaround is to add the @objc
tag to the method in the superclass
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
add a comment |
We ran into this with a UITextViewDelegate
Another workaround is to add the @objc
tag to the method in the superclass
We ran into this with a UITextViewDelegate
Another workaround is to add the @objc
tag to the method in the superclass
answered Apr 12 at 13:41
ndis1ndis1
1341 silver badge4 bronze badges
1341 silver badge4 bronze badges
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
add a comment |
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
This worked for me even though all of my related code was in swift. I think it works because it introduces dynamic lookup/dynamic dispatch.
– Andrew Paul Simmons
Apr 12 at 15:02
add a comment |
I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.
For those who don't want to add @objc everywhere in your delegate implementation.
The quick solution is to disable the Swift 5 compiler optimisation in the build settings:
For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward.SWIFT_COMPILATION_MODE = singlefile;
add a comment |
I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.
For those who don't want to add @objc everywhere in your delegate implementation.
The quick solution is to disable the Swift 5 compiler optimisation in the build settings:
For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward.SWIFT_COMPILATION_MODE = singlefile;
add a comment |
I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.
For those who don't want to add @objc everywhere in your delegate implementation.
The quick solution is to disable the Swift 5 compiler optimisation in the build settings:
For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward.SWIFT_COMPILATION_MODE = singlefile;
I experienced the same issue only with the release scheme after upgrading to Xcode 10.2. I also tested Xcode 10.3 and it is exactly the same behavior.
For those who don't want to add @objc everywhere in your delegate implementation.
The quick solution is to disable the Swift 5 compiler optimisation in the build settings:
For those who already upgraded to Xcode 10.3, it seems that this build settings option is not visible anymore, but you can still change it directly via the pbxproj file of your project and it should appear in the xcode UI afterward.SWIFT_COMPILATION_MODE = singlefile;
answered Jul 30 at 5:59
GominoGomino
8,1882 gold badges25 silver badges39 bronze badges
8,1882 gold badges25 silver badges39 bronze badges
add a comment |
add a comment |
Since all of UIScrollViewDelegate
methods are optionals you will never see an error from compiler if it thinks that you didn't implement them, most probably what is happening is that Apple changed method signature in Swift 5 (again) and for some reason the migration tool didn't work.
Check the methods names along with UIScrollViewDelegate
updated to USwift 5 documentation, you will see that probably your methods names are different, simply correct them and everything should work again.
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
add a comment |
Since all of UIScrollViewDelegate
methods are optionals you will never see an error from compiler if it thinks that you didn't implement them, most probably what is happening is that Apple changed method signature in Swift 5 (again) and for some reason the migration tool didn't work.
Check the methods names along with UIScrollViewDelegate
updated to USwift 5 documentation, you will see that probably your methods names are different, simply correct them and everything should work again.
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
add a comment |
Since all of UIScrollViewDelegate
methods are optionals you will never see an error from compiler if it thinks that you didn't implement them, most probably what is happening is that Apple changed method signature in Swift 5 (again) and for some reason the migration tool didn't work.
Check the methods names along with UIScrollViewDelegate
updated to USwift 5 documentation, you will see that probably your methods names are different, simply correct them and everything should work again.
Since all of UIScrollViewDelegate
methods are optionals you will never see an error from compiler if it thinks that you didn't implement them, most probably what is happening is that Apple changed method signature in Swift 5 (again) and for some reason the migration tool didn't work.
Check the methods names along with UIScrollViewDelegate
updated to USwift 5 documentation, you will see that probably your methods names are different, simply correct them and everything should work again.
answered Mar 28 at 8:52
AndreaAndrea
20.3k9 gold badges74 silver badges112 bronze badges
20.3k9 gold badges74 silver badges112 bronze badges
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
add a comment |
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
1
1
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
Thanks for your answer. The naming was correct, but I upvoted it since it might be useful for future readers.
– Jan Schlorf
Mar 28 at 9:18
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
This answer might be useful, but the correct answer is adding @objc. The method signatures are correct.
– Andrew Paul Simmons
Apr 12 at 15:03
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%2f55393027%2fdelegate-methods-in-child-class-sometimes-not-called-with-swift-5-compiler%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
Unrelated: There should be a better approach to do what you are trying to do than nesting scroll views.
– Rakesha Shastri
Mar 28 at 8:36
@RakeshaShastri Hm, maybe as child view controllers?
– Jan Schlorf
Mar 28 at 8:47
Maybe. I wouldn't know because i don't know what they are for. The downvotes may be because you haven't shown the question is too vague. P.S - i did not downvote.
– Rakesha Shastri
Mar 28 at 8:53
5
This should not been downvoted at all! It's a breaking change in the latest Xcode / Swift compiler
– Claus Jørgensen
Apr 2 at 11:17