10250

XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass

I encounter some issues on collectionView & collectionViewLayout on Xcode 8 + Swift 3 project.

It's seems some methods totally disappeared.

For example, when I subclass UICollectionViewFlowLayout:

override func layoutAttributesClass() -> AnyClass

This trigger xcode error:

Method does not override Any Method from his superclass

Documentation of this method: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewLayout_class/index.html#//apple_ref/occ/clm/UICollectionViewLayout/layoutAttributesClass

Not sure it's Xcode 8 related because I already have strange issues with collectionView on Xcode 7 and swift 2.3, for example, itemSizeAtIndexPath method is not detected on xcode but if I put the method in a collectionViewController it's called even without the keyword override.

Answer1:

In Swift 3, it is a (class) property instead of a method:

override class var layoutAttributesClass: AnyClass { // ... }

Recommend

  • Convert Func to Func
  • Disable div click on Ajax start and re-enable it on Ajax complete
  • 2-table interaction: insert, get result, insert
  • why fullscreen functionality is not working in chrome?
  • Custom Nav Title offset ios 11
  • Basic defensive programming [duplicate]
  • FTS3 searches in ORMLite?
  • Distributed JMS based logging .. falling flat?
  • Tools for understanding HTML layout
  • What is the difference between a “service account” and an “installed application”?
  • Cuda Clang and OS X Mavericks
  • Where can I find tomesh.c?
  • Can I use AllJoyn Framework for Wifi Direct in iOS?
  • Does Apportable support to build library binary (.a/.so)?
  • How to set elevation color?
  • Who propagate bugfixes across branches (corporate development)?
  • How to add a focus style to an editable ComboBox in WPF
  • Installing iPhone App to iPhone
  • Xcode 4 NSLog Macro link in Xcode 3
  • Functions in global context
  • Asynchronous UI Testing in Xcode With Swift
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Why is an OPTIONS request sent to the server?
  • Update CALayer sublayers immediately
  • RectangularRangeIndicator format like triangular using dojo
  • swift auto completion not working in Xcode6-Beta
  • Cross-Platform Protobuf Serialization
  • Is there a mandatory requirement to switch app.yaml?
  • Revoking OAuth Access Token Results in 404 Not Found
  • WPF Applying a trigger on binding failure
  • Hits per day in Google Big Query
  • -fvisibility=hidden not passed by compiler for Debug builds
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?