Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'
Note: Ensure swift language version of your project. Here is how you can see/check your swift language version.
You have two options as solution to your query:
If your project has Swift versio 4.0
- You should choose/download POD compatible to your project's swift language (Share me POD info and swift version, so I can provide you exact pod version version for your pod library suitable for project).If your project has swift version below 4.0
- You need to migrate your project into Swift 4.0 (if you've not migrated it). Here is ref question and answer, how to migrate from swift (below) <4.0 to 4.0.- Xcode 9 Swift Language Version (SWIFT_VERSION)
According to tag added by you in your question - Swift3 is your current project language version and pod 'Cosmos', '~> 12.0' is supporting swift 4.
pod 'Cosmos', '~> 12.0'
Here is list of previous release supporting Swift version below 4.0.
https://github.com/evgenyneu/Cosmos/releases
Try previous release of cosmos like:
pod 'Cosmos', '~> 11.0.3'
// or
pod 'Cosmos', '~> 11.0.1'
// or
pod 'Cosmos', '~> 11.0.0
'
Type 'CAGradientLayerType' (aka 'NSString') has no member 'conic'
Thanks to this answer looks like the issue was my swift language version (Target > Build Settings > Swift Language Version). It needs to be version 5 to use this syntax. Otherwise, I guess we would need to treat that property as a string, and set it to kCAGradientLayerConic
.
Error setting 'foregroundColor' in macOS
Swift 3 doesn't use the new Swift 4 NSAttributeStringKey
values.
Use NSForegroundColorAttributeName
for the foreground color:
let placeHolderTitleString: NSAttributedString =
NSAttributedString(string: "Enter text here", attributes:
[NSForegroundColorAttributeName : NSColor.gray])
Type 'UIPageViewController.OptionsKey' (aka 'NSString') has no member 'interPageSpacing'
The syntax was different in Swift 4. Your current project might be in Swift 4.0. Change its swift version to 4.2 and above. Or use the below code
init(transitionStyle style: UIPageViewControllerTransitionStyle,
navigationOrientation: UIPageViewControllerNavigationOrientation,
options: [String : Any]? = nil)
Swift 4.0
let vc = UIPageViewController(transitionStyle: .scroll,
navigationOrientation: .vertical,
options: [UIPageViewControllerOptionInterPageSpacingKey : 10])
Swift 4.2 and above
let vc = UIPageViewController(transitionStyle: .scroll,
navigationOrientation: .vertical,
options: [UIPageViewController.OptionsKey.interPageSpacing : 10])
NSFontAttributeName vs NSAttributedStringKey.font
The projects are probably in different versions of Swift.
In Swift 4, NSFontAttributeName
has been replaced with NSAttributedStringKey.font
.
In Swift 5, NSFontAttributeName
has been replaced with NSAttributedString.Key.font
.
NSAttributedString has no member replacingOccurrences error
First:
A StringProtocol defined by apple documentation:
A type that can represent a string as a collection of characters.
Im assuming that the variable str25
is an NSAttributedString
This is the cause of your error. Ensure that the variable you pass into replacingOccurrences(of:with:)
is of Type String
Another route you could take is to convert your String
into an NSMutableAttributedString
, this object has a var mutableString: NSMutableString { get }
property that
returns The mutable string object
Then you can use this in your replacingOccurrences(of:with:)
method
Related Topics
How to Cancel Usernotifications
iOS Notification Trigger: Fortnightly And/Or Quarterly
How to Detect Tap on Clear Part of Uitableview
Xcode:Why Launchoptions in Didfinishlaunchingwithoptions Always Nil
Fire a Notification at a Specific Day and Time Every Week
Swift- Custom Uitableviewcell Delegate to Uiviewcontroller Only One Protocol Works
Facebook Sdk - iOS - Fail to Share Url (Error 102)
Parsing JSON Using the New Swift 3 and Alamofire
Didbegincontact Is Being Called Multiple Times for the Same Skphysicsbody
iOS Facebook Sdk 3.1 Retrieve Friend Birthday Returning Null
Confirm Back Button on Uinavigationcontroller
iOS Document/File Type Associations - Wildcard Uti
How to Access Extension of Uicolor in Swift
Swiftui: How to Get Continuous Updates from Slider
Swift Unsafemutablepointer<Unmanaged<Cfstring>> Allocation and Print
How to Hide "Back to Safari" from Status Bar in iOS9
Initializing Swift Properties That Require "Self" as an Argument