Uploaded image for project: 'Swift'
  1. Swift
  2. SR-5748

Swift 4 issue with class_copyPropertyList ( describing the properties declared by the class)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Invalid
    • Component/s: Compiler
    • Labels:

      Description

      In Swift 4 i am facing one compilation issue with below code .

      var outCount:UInt32 = 0;
      var rawProperties:UnsafeMutablePointer<objc_property_t?>! = class_copyPropertyList(clazz, &outCount)

      Getting Compile time issue : Cannot convert value of type 'UnsafeMutablePointer<objc_property_t>?' (aka 'Optional<UnsafeMutablePointer<OpaquePointer>>') to specified type 'UnsafeMutablePointer<objc_property_t?>!' (aka 'ImplicitlyUnwrappedOptional<UnsafeMutablePointer<Optional<OpaquePointer>>>')

      But when i am change it with ! to ? then able to compile but not getting class property count.

      var rawProperties:UnsafeMutablePointer<objc_property_t?>? = class_copyPropertyList(clazz, &outCount)
      Would any one can correct above code snippet?

      Thanks

        Attachments

          Activity

            People

            Assignee:
            huon Huon Wilson
            Reporter:
            sandeep.sharma Sandeep
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: