//
// NibResource+UIKit.swift
// R.swift.Library
//
// Created by Mathijs Kadijk on 06-01-16.
// From: https://github.com/mac-cain13/R.swift.Library
// License: MIT License
//
import Foundation
import UIKit
public extension NibResourceType {
/**
Instantiate the nib to get the top-level objects from this nib
- parameter ownerOrNil: The owner, if the owner parameter is nil, connections to File's Owner are not permitted.
- parameter options: Options are identical to the options specified with -[NSBundle loadNibNamed:owner:options:]
- returns: An array containing the top-level objects from the NIB
*/
public func instantiate(withOwner ownerOrNil: Any?, options optionsOrNil: [AnyHashable : Any]? = [:]) -> [Any] {
return UINib(resource: self).instantiate(withOwner: ownerOrNil, options: optionsOrNil)
}
}
Error:
return UINib(resource: self).instantiate(withOwner: ownerOrNil, options: optionsOrNil)
Cannot convert value of type '[AnyHashable : Any]?' to expected argument type '[UINib.OptionsKey : Any]?
This is updated in the library, there just isn't a release yet.
This commit fixes the issue: https://github.com/mac-cain13/R.swift.Library/commit/38252b2c5a54b619b362127db6b2d22c43fe1f20
For now you can use the master version of the library if you want to use R.swift with Xcode 10.
Note that this fix breaks with xcode v9.4.1.
error: 'OptionsKey' is not a member type of 'UINib'
public func instantiate(withOwner ownerOrNil: Any?, options optionsOrNil: [UINib.OptionsKey : Any]? = [:]) -> [Any] {
I've tested with master @ f72f73d
That is correct, R.swift 4 is compatible with Xcode 9, R.swift 5 has the changes needed for Xcode 10.
We we'll drop support for Xcode 9 with R.swift 5.
the error still occurs. swift 4.2
Modify the Podfile:
pod 'R.swift', '~> 5.0.0.alpha.2'
the error still occurs. swift 4.2 / Xcode 10.1 / Rswift 5.0.0
just for reference for anyone finding this issue: I solved this by just setting swift 4.2 to the R.swift.Library dependency (before upgrading I had to set it to 4.1)
Most helpful comment
the error still occurs. swift 4.2 / Xcode 10.1 / Rswift 5.0.0