-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributeattributesFeature: Declaration and type attributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesduplicateResolution: Duplicates another issueResolution: Duplicates another issueobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Cregressionswift 5.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect outputwhole module optimization onlyFlag: An issue whose reproduction requires whole module optimizationFlag: An issue whose reproduction requires whole module optimization
Description
Previous ID | SR-11073 |
Radar | None |
Original Reporter | andoku901 (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Duplicate |
Attachment: Download
Environment
XCode 10.2.1 default toolchain
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 6d8b5869344f293ba1395c7797c79f52
duplicates:
Issue Description:
Write the following code in a Swift file:
class SwiftVC<View: UIView>: UIViewController, UICollectionViewDelegateFlowLayout {
var rootView: View? {
return self.view as? View
}
}
final class SubSwiftVC: SwiftVC<UIView> {
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize
{
return .zero
}
}
class SwiftVCAdaptor: NSObject {
@objc func vc() -> UIViewController {
return SubSwiftVC()
}
}
Then write in an Objective-C file the next:
UIViewController *vc = [[SwiftVCAdaptor new] vc];
if ([vc respondsToSelector:@selector(collectionView:layout:sizeForItemAtIndexPath:)]) {
// This is not executed.
}
This behavior can be fixed by declaring collectionView:layout:sizeForItemAt:
method in SwiftVC
and overriding it in SubSwiftVC
.
Metadata
Metadata
Assignees
Labels
@objcFeature → attributes: The @objc attributeFeature → attributes: The @objc attributeattributesFeature: Declaration and type attributesFeature: Declaration and type attributesbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesduplicateResolution: Duplicates another issueResolution: Duplicates another issueobjective-c interopFeature: Interoperability with Objective-CFeature: Interoperability with Objective-Cregressionswift 5.0type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysisunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect outputwhole module optimization onlyFlag: An issue whose reproduction requires whole module optimizationFlag: An issue whose reproduction requires whole module optimization