Having trouble updating my project to Xcode 10. When building I receive
Value of type 'SwiftMessages.Config' has no member 'presentationContext'; did you mean 'presentationStyle'?. I am running swift version 4.0 could the latest version of SwiftMessages be built for swift 4.2, would that even have that affect? If so what version should i be on for Swift 4.0?
SwiftMessages Version: 5.0.3
Swift version: 4.0
Xcode version: 10
Try 5.0.1
I think this is fixed. I reconfigured the releases to follow semantic versioning:
5.0.1 Final Swift 4.1 release
6.0.0 Swift 4.2 release
Unfortunately, I had to delete 5.0.2 and 5.0.3, which may break for some people. But this seems like the best path going forward. Anyone doing something like this will not get the Swift 4.2 version:
pod 'SwiftMessages', '~> 5.0'
Please let me know if this works for you.
@wtmoose Upgrading to 6.0.0 didn't help. Is presentationContext removed?
No.
In following the semantic versioning rules, 6.0.0 is the Swift 4.2 release. You'll need to stay on 5.0.1 if your project isn't on Swift 4.2.
To clarify, I've confirmed that if your app is on Swift 4.1, then the Swift 4.2 version of SwiftMessages gives a compile error about presentationContext (which does exist). I'm not an expert on mixing Swift versions, so my suggestion is to stay on 5.0.1.
Yep, I confirmed this is the issue. Thanks!
Yea that worked, Thanks for the quick response!
just comment presentationContext line
// warningConfig.presentationContext = .window(windowLevel: UIWindowLevelStatusBar)
and call .show method it will work.
SwiftMessages.show(view: warning);
//Podfile pod 'SwiftMessages', '~> 5.0.1'
//Swift 4.1
let status = MessageView.viewFromNib(layout: .statusLine)
status.backgroundView.backgroundColor = UIColor.purple
status.bodyLabel?.textColor = UIColor.white
status.configureContent(body: "A tiny line of text covering the status bar.")
var statusConfig = SwiftMessages.defaultConfig
statusConfig.presentationContext = .window(windowLevel: UIWindowLevelStatusBar)
SwiftMessages.show(config: statusConfig, view: status)
works for me..
@wtmoose Changing pod version back to 5.0.1 worked for me, thanks!
bump this is still an issue. is there no way to support 4.1 :/
@anushkmittal huh?
@wtmoose I have the same issue, I have swift 4.1, xcode 10, SwiftMessages 5.0.1, and I get SwiftMessages.Config has no member presentationContext. What could be the issue? Can I stay on swift 4.1?
@merimprop SwiftMessages 5.0.1 has been verified to work with Swift 4.1. I suggest that you go back and verify your SwiftMessages and Swift versions.
Alhamdulellah
Worked for me swift 4, Xcode Version 10.3 , pod 'SwiftMessages', '~> 5.0'
code is:
let view = MessageView.viewFromNib(layout: .statusLine)
view.configureTheme(.error)
view.configureContent(body: "No Internet Connection")
view.configureDropShadow()
var config = SwiftMessages.Config()
config.duration = .seconds(seconds: 5)
SwiftMessages.show(config: config, view: view)
Most helpful comment
To clarify, I've confirmed that if your app is on Swift 4.1, then the Swift 4.2 version of SwiftMessages gives a compile error about
presentationContext(which does exist). I'm not an expert on mixing Swift versions, so my suggestion is to stay on 5.0.1.