-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift 4.2 #10
base: master
Are you sure you want to change the base?
Swift 4.2 #10
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,11 @@ open class MarkdownHeader: MarkdownLevelElement { | |
attributedString.deleteCharacters(in: range) | ||
} | ||
|
||
open func attributesForLevel(_ level: Int) -> [NSAttributedStringKey: Any] { | ||
open func attributesForLevel(_ level: Int) -> [NSAttributedString.Key: Any] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This alone will break compatibility with Swift 4.1: better also declare a compatibility layer with previous Swift version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe create a typealias like this. #if swift(>=4.2)
public typealias MarkdownAttribute = [NSAttributedString.Key: Any]
#else
public typealias MarkdownAttribute = [NSAttributedStringKey: Any]
#endif |
||
var attributes = self.attributes | ||
if let font = font { | ||
let headerFontSize: CGFloat = font.pointSize + (CGFloat(6 - level) * CGFloat(fontIncrease)) | ||
attributes[NSAttributedStringKey.font] = font.withSize(headerFontSize) | ||
attributes[.font] = font.withSize(headerFontSize) | ||
} | ||
return attributes | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but can be done in an independant pull request.