A declaration cannot be both 'final' and 'dynamic' error in Swift 1.2

后端 未结 7 1353
Happy的楠姐
Happy的楠姐 2021-01-30 07:55

The declaration of value below

import Foundation

class AAA: NSObject {
    func test2() {
        self.dynamicType
    }
}
extension AAA {
    stat         


        
7条回答
  •  借酒劲吻你
    2021-01-30 08:17

    I solved this issue by moving the static declaration into the new struct I defined in the extension.

    So instead of this:

    extension NSOperationQueue {
        static var parsingQueue : NSOperationQueue = {
            let queue = NSOperationQueue()
            queue.maxConcurrentOperationCount = 1
            return queue
            }()
    }
    

    I have this:

    extension NSOperationQueue {        
        struct Shared {
            static var parsingQueue : NSOperationQueue = {
                let queue = NSOperationQueue()
                queue.maxConcurrentOperationCount = 1
                return queue                
                }()
        }
    }
    

提交回复
热议问题