chrisdhaan / CDMarkdownKit

An extensive Swift framework providing simple and customizable markdown parsing.
MIT License
254 stars 66 forks source link

Swift 4 Support? #5

Closed WillBishop closed 5 years ago

WillBishop commented 6 years ago

ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.

Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag cdmarkdownkit.

Please remove this line and everything above it before submitting.

What did you do?

ℹ Please replace this with what you did.

I expected Swift 4 to work

ℹ Please replace this with what you expected to happen.

It crashed with numerous errors, some fixable, others not.

ℹ Please replace this with of what happened instead.

CDMarkdownKit Environment

CDMarkdownKit version:
Xcode version:
Swift version:
Platform(s) running CDMarkdownKit:
macOS version running Xcode:

Demo Project

ℹ Please link to or upload a project we can download that reproduces the issue.

tklucher commented 6 years ago

@WillBishop Swift 4 is not currently supported yet but should be soon as per this conversation.

If you would like to play with the code right now that pull request is swift 4 compatible and has no API changes so it would be a drop in change back to this repo when the swift 4 version which is planned to be 1.0.0 is released. The render will be slightly different than the release version as that developer of that pull also changed paragraph styles and those may not be implemented for a bit. That is a currently feature request here that will be reviewed by @chrisdhaan over time.

chrisdhaan commented 6 years ago

@WillBishop I'm working to get this project up to date for Swift 4 very soon. I've unfortunately been very busy as of late and have not been able to donate as much time as I'd like to development. I hope to have another update out after this weekend.

WillBishop commented 6 years ago

Good luck! It’s the only markdown kit that supports watchOS so I’m looking forward to the update!

On 28 Feb 2018, 11:34 AM +1030, Christopher de Haan notifications@github.com, wrote:

@WillBishop I'm working to get this project up to date for Swift 4 very soon. I've unfortunately been very busy as of late and have not been able to donate as much time as I'd like to development. I hope to have another update out after this weekend. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

WillBishop commented 6 years ago

Actually just checked the pull request and it doesn't have watchos support seemingly

chrisdhaan commented 6 years ago

@WillBishop started working on #4 which is the last thing I'd like to finish before releasing 1.0.0. Should be done within the next couple of days. After that I'll update to Swift 4 and push 1.1.0. Hopefully within a weeks time your needs will be met.

WillBishop commented 6 years ago

Fantastic! Appreciate the work!

On 15 Mar 2018, 10:51 AM +1030, Christopher de Haan notifications@github.com, wrote:

@WillBishop started working on #4 which is the last thing I'd like to finish before releasing 1.0.0. Should be done within the next couple of days. After that I'll update to Swift 4 and push 1.1.0. Hopefully within a weeks time your needs will be met. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

chrisdhaan commented 6 years ago

@WillBishop I've finished #4 and also fixed some formatting on other markdown elements. The last thing I wanted to do was add link selection support to the UILabel element before releasing 1.0.0. But if Swift4 is holding you up from release. I can prioritize Swift4 ahead of the UILabel work and just release 1.0.0 now and update to Swift4 with 1.1.0 tomorrow. Let me know whats best for you.

WillBishop commented 6 years ago

Whatever works best for you man,

I’ve got a Swift 4 fork anyway, official support would be preferred but no need to prioritise it!

On 23 Mar 2018, 9:00 AM +1030, Christopher de Haan notifications@github.com, wrote:

@WillBishop I've finished #4 and also fixed some formatting on other markdown elements. The last thing I wanted to do was add link selection support to the UILabel element before releasing 1.0.0. But if Swift4 is holding you up from release. I can prioritize Swift4 ahead of the UILabel work and just release 1.0.0 now and update to Swift4 with 1.1.0 tomorrow. Let me know whats best for you. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

FelixLisczyk commented 6 years ago

Hi @chrisdhaan,

I've started using and integrating this library into my own project. Really like it so far. What's the current status of the 1.0/Swift 4 release?

Thanks and keep up the good work!

chrisdhaan commented 6 years ago

@FelixII apologies on the delay. I was out of the country for the past two weeks and did not have a computer with me. I plan on getting back to working on the project this upcoming week.

WillBishop commented 6 years ago

I’m not Felix, but no problem Chris!

On 22 Apr 2018, 6:24 PM +0930, Christopher de Haan notifications@github.com, wrote:

@FelixII apologies on the delay. I was out of the country for the past two weeks and did not have a computer with me. I plan on getting back to working on the project this upcoming week. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

FelixLisczyk commented 6 years ago

That's good news. Take your time.

robotsquidward commented 6 years ago

Love this lib, but struggling to do a Swift 4 convert in my project in the 0.9 release. Any update?

chrisdhaan commented 6 years ago

Had a break through over the weekend with the final functionality I was trying to get in before updated to Swift 4. Should hopefully see it sometime around Monday or Tuesday @robotsquidward

robotsquidward commented 6 years ago

Thanks @chrisdhaan! You'll save me from some regex madness trying to create my own with a standard UITextView 🤓

chrisdhaan commented 6 years ago

Added Swift 4 support with version1.1.0. @robotsquidward @FelixII @WillBishop @tklucher please let me know if you run into any issues. If everything is working fine I'll close out this issue.

FelixLisczyk commented 6 years ago

Thanks for your work, @chrisdhaan. I've noticed that the SWIFT_VERSION property in your project settings is still set to 3.0. As soon as I change it to 4.0 and build the project, I receive the following error in several places:

Cannot convert value of type '[String : AnyObject]' to expected argument type '[NSAttributedStringKey : Any]'

Swift 4 changed the key type of attribute dictionaries from String to NSAttributedStringKey. However CDMarkdownStyle still uses String as the key type for its attributes property.

Is there a commit missing?

chrisdhaan commented 6 years ago

@FelixII this is a good find. Thanks for pointing it out. I'm surprised the CI didn't generate this error nor did Xcode while I was making the update. I'll fix it today.

FelixLisczyk commented 6 years ago

Xcode displays compiler errors and warnings based on the selected Swift version. Set the "Swift Language Version" to "Swift 4.1" in your project settings and you should see the errors.

FelixLisczyk commented 6 years ago

CDMarkdownKit compiles fine now with Swift 4. Thanks again, @chrisdhaan !

FelixLisczyk commented 6 years ago

I've discovered two more compiler issues with the macOS target and create a PR: #10

darrinhenein commented 6 years ago

Xcode displays compiler errors and warnings based on the selected Swift version. Set the "Swift Language Version" to "Swift 4.1" in your project settings and you should see the errors.

I see numerous compilation errors with either Swift 4.1 or 4.2 as well.

Mostly: Cannot convert value of type '[String : AnyObject]' to expected argument type '[NSAttributedStringKey : Any]'

FelixLisczyk commented 6 years ago

@darrinhenein Please make sure that you have fetched the latest commit from this repo. If you're using CocoaPods, you have to specify the repo explicitly because the tag is a few commits behind:

pod 'CDMarkdownKit', :git => 'https://github.com/chrisdhaan/CDMarkdownKit'

chrisdhaan commented 6 years ago

@darrinhenein I'll be releasing a new tag in the next couple of days if you'd rather wait for that.

edwardmp commented 6 years ago

@chrisdhaan

can you release a new tag? thanks!

chrisdhaan commented 6 years ago

@edwardmp apologies on the slow release. I've been out of town the last couple of weeks. I have a busy day today but should be able to tomorrow or Friday.

chrisdhaan commented 6 years ago

@edwardmp I pushed up my last commits for the new version today. The CHANGELOG.md and once the Travis CI build finishes I'll release a new tag.

edwardmp commented 6 years ago

@chrisdhaan

Great job, thanks! Little but offtopic, but could you tell me the best way to detect/handle presses on links? Which component of CDMarkdownKit is best suited to handle this?

chrisdhaan commented 6 years ago

Version 1.2.0 has been released. I'll keep this Issue open for a while in case other problems arise with Swift 4 compatibility.

FelixLisczyk commented 6 years ago

@edwardmp If you're using UITextView, take a look at https://developer.apple.com/documentation/uikit/uitextviewdelegate/1649337-textview

chrisdhaan commented 5 years ago

Version 1.2.1 is being released to with Swift 4.2 compatibility and fixes issues with 4.0 compilation errors. Closing issue.