Skip to content
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 2.3 & 3.0 support: news, issues, PRs and state #1291

Closed
liuxuan30 opened this issue Aug 5, 2016 · 60 comments
Closed

Swift 2.3 & 3.0 support: news, issues, PRs and state #1291

liuxuan30 opened this issue Aug 5, 2016 · 60 comments

Comments

@liuxuan30
Copy link
Member

liuxuan30 commented Aug 5, 2016

Using this thread to list the current news, issues, PRs, and state for swift 3.0 support. This post will be updated accordingly.

As Xcode beta 4 comes out, there are even more changes(#1290), seems it's much easier to convert the library after swift 3.0 released once and for all, than continuous merging from beta 1 to beta N and finally merge into master.

Xcode beta 6 has even more changes based on beta 4.. But thanks to @acegreen, we now on beta 6 now.

Therefore, I am thinking the current Swift 2.3 and 3.0 branches are just for everyone to test their apps with iOS 10 beta. Thanks for everyone who commits into 2.3 and 3.0 branch.

What branch to use?

Swift 3.0 + Charts 3.0 -> Master // this is recommended to pick :)

Swift 2.3 + Charts 2.2.5 -> Chart2.2.5-Swift2.3 branch
Swift 3.0 + Charts 2.2.5 -> Chart2.2.5-Swift3.0 branch
Swift 2.3 + Charts 3.0 feature ready -> Chart3.0-Swift2.3 branch

Progress

Master branch has migrated to Swift 3.0 and Chart 3.0 and this is the branch will get bug fix and new features. Other temp branches will be deleted once it's stable. Those branches are just for people to pick whatever the need to use in their project for upgrading Xcode 8, however they are not maintained, or at least only small bug fixes for Swift will kick in. Any bugs that are Chart 2.2.5 specific won't be fixed in these temp branches.

Swift-3.0 branch is based on Charts 2.2.5; has some fixes for OS X demo on Xcode 8 GM
Swift-2.3 branch is sync with master(Chart v3.0 feature ready) 5e020a8 for iOS 10/macOS + Charts 3.0 on Xcode beta 6, works fine on Xcode 8 GM
Chart2.2.5-Swift2.3 branch is based on Chart 2.2.5 release and converted to Swift 2.3 on Xcode beta 6 works fine on Xcode 8 GM

Open issues (up to Xcode 8 GM):

#1421 linear line chart has additional line segments wile zooming in (PR #1420)
#1269: Realm swift 3.0 support is blocked due to Xcode 8 beta 3 & 4 swift compiler bug

This seems a compiler bug pending to fix. Anyone relies one Realm have to wait until this bug has been fixed. Please use Swift 2.3 to test iOS 10. Now, the code is ready (PR #1414), but pending a swift 3 Realm framework to test.
#1171: I found this PR removed isDrawValuesEnabled and other similar protocol methods prefixed with 'is', that's why #1295 is removing 'is' from the function name... Watch out

function inconsistency:

Seeing different signatures for same API on macOS and iOS, such as:

NSFont:
class func systemFontSize()
UIFont:
class var systemFontSize: CGFloat { get }

NSParagraphStyle

NSParagraphStyle:
on macOS, it's:
class func default() -> NSParagraphStyle
on iOS, it's:
class var default: NSParagraphStyle { get }

I have filed a bug 27731357 on radar. If they intended to do so, we have to wrap it.. again

Pull requests:

Swift 3.0

#1414 is merged for Realm extension issue, still need Realm to release Swift 3.0 branch to make the framework compile.
#1378 is merged for migrating public to open (SE-1107)
#1342 is meged for Xcode beta 6
#1294, #1295 is merged for Xcode beta 4, including project settings, ChartsRealm, ChartsDemo

If you remove all Realm related files and code, you should be able to launch ChartsDemo with Xcode beta 4 now.
#1290 is merged for Xcode beta 4
#1266 is merged via #1296 due to conflicts (RunLoopMode changes)

Swift 2.3

#1389 is merged for Xcode beta 6 + Charts v3.0 code in master, at 5e020a8
#1281 is merged for Xcode beta 4

@danielgindi
Copy link
Collaborator

Yes I totally agree! The Swift-2.3 and Swift-3.0 branches are temporary, and eventually there will be a clean migration of master to Swift-3.0.

It will hopefully happen before releasing Charts 3.0 (depending on iOS release), but in the worst case there will be a minor version release for that.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Aug 6, 2016

Jesus I wanted to add OS X demo, however found new issues instead.. their api signatures changed... like

NSFont:
class func systemFontSize()
UIFont:
class var systemFontSize: CGFloat { get }

filed a bug 27731357 on radar. I will hold OS X demo now.

@mccpower
Copy link

I am not able to get the demo project compiling with Xcode 8 beta 5, the error that I get is:

"Swift Compiler Error:
Command failed due to signal: Segmentation fault: 11"

I've taken a look and it seems that this type of error can come when there is some code written that the compiler is not able to manage.

@danielgindi
Copy link
Collaborator

Please look at the details of the error. Where it happens, what is the origin and the reason.
It might be the compiled framework of Realm etc. I'm looking for ways to allow the demo to compile without it.

@liuxuan30
Copy link
Member Author

"Swift Compiler Error:Command failed due to signal: Segmentation fault: 11" smells like Realm issue...

@leonidster
Copy link

Hi Daniel, we use your wonderful project in our app as source files import, because we make code changes for our special needs. I want to prepare our app for iOS 10, I downloaded the swift 3 branch files, and got many compilation errors on Xcode 8 beta 6. Do you know when to expect a resolution?

@danielgindi
Copy link
Collaborator

I would suggest to download the master repo, and let Xcode convert everything to Swift 3. Note that it is the new Charts 3.0 version (not released yet), so there are API changes.
When the release will come out - I will write down notes on how to migrate from 2.0 to 3.0

@leonidster
Copy link

Thanks for reply. So why did you create the Swift 3 branch? You wrote it exists so users can test their apps with iOS 10 beta. From my experience, Xcode Swift 3 migration tool misses spots, and I still need to fix many syntax errors manually..

@pritamd20
Copy link

pritamd20 commented Aug 24, 2016

Swift 3 branch was created to put swift 3 code, and it works fine in XCode beta 4 (swift 3). But apple has changed many things in swift 3 for beta 4 release to beta 6. I just finished fixing the beta 6 errors, if you want you can download it from https://dl.dropboxusercontent.com/u/15467048/ChartsSwift-3(beta6).zip
It works on beta 6 but may have some bugs as it is not tested.
Thank you.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Aug 30, 2016

UPDATE:
#1342 is merged, so beta 6 should work except for macOS portion (another PR pending)

I am maintaining swift 3.0 branch - sorry I took a vacation last week so it's late. We got a PR pending to merge for beta6, but beta 6 still has so many changes compared to previous BETAs, we have to be careful. I am going to merge the PR soon.

For people using swift 3.0 - I would say you could rely on the conversion tool and manually fix some API changes and stick to that working version. From beta to beta, the API changes so frequently, no need to test every beta I think

@Sealos
Copy link

Sealos commented Aug 30, 2016

Hello! I have a question regarding a functionality that got dropped on the recent update. Recently Swift 3 added the 'open' access level identifier and moved the 'public' identifier as only subclassable inside of the module.

Is it intended that none of the charts are subclassable now? Since they all have public identifiers.

Thank you.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Aug 31, 2016

@Sealos I don't realize it yet, since it comes with beta 6, and we just fixed beta 6 issues. I see PR #1376 marking ChartMarker as open.

I think we allow subclassing outside the module. Since open in swift 3 is like public in swift 2 More details: SE-0117

@liuxuan30 liuxuan30 changed the title Swift 3.0 support: news, issues, PRs and state Swift 2.3 & 3.0 support: news, issues, PRs and state Sep 1, 2016
@liuxuan30
Copy link
Member Author

I have migrate master branch into swift 2.3 branch, to test iOS 10 + Charts v3.

@leonidster
Copy link

Thanks for your hard work. I want to replace my current Charts library in the project with updated one using Xcode 8 beta, to be prepared for iOS 10 release. What branch should I use, Swift-3.0 branch with Charts 2.2.x or Swift-2.3 branch with Charts 3.0? I'm a little bit confused... Will Swift-2.3 branch code compile on Xcode 8 beta without errors?

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 1, 2016

@leonidster if you needs Chart 3.0 features, pick swift-2.3 branch directly; if you want Chart 2.x, I would still choose swift 2.3.
I created Chart2.2.5-Swift2.3 for Chart 2.2.5 and swift 2.3. Pick whatever you want.

@leonidster
Copy link

@liuxuan30 Will swift-2.3 branch compile on Xcode 8 beta, or I need to run migration tool manually and fix Swift 3 compilation errors by myself?

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 1, 2016

not sure why you involve swift 3, but swift 2.3 branches run perfectly on beta 6.

@liuxuan30
Copy link
Member Author

Xcode 8 GM works great with current Swift-2.3 branches

@thierryH91200
Copy link
Contributor

the same thing with Xcode 8 GM build Version 8.0 (8A218a) with Swift-3.0 branches on macOS
no problem for my project

@liuxuan30
Copy link
Member Author

@thierryH91200 I am working on macOS portion for Swift 3.0, and I do see some issues.. wonder if you fixed something on your side

@thierryH91200
Copy link
Contributor

Le 8 sept. 2016 à 08:43, Xuan notifications@github.com a écrit :

@thierryH91200 https://github.com/thierryH91200 I am working on macOS portion for Swift 3.0, and I do see some issues.. wonder if you fixed something on your side


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1291 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AF9jx_YPraxTCDle31q1sDMuZZ_UVmOsks5qn651gaJpZM4JdQ_w.

i have got a problem for LineDemoViewController for mac os

//
// LineDemoViewController.swift
// ChartsDemo-OSX
//
// Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda
// A port of MPAndroidChart for iOS
// Licensed under Apache License 2.0
//
// https://github.com/danielgindi/ios-charts https://github.com/danielgindi/ios-charts

import Foundation
import Cocoa
import Charts

public class LineDemoViewController: NSViewController
{
@IBOutlet var lineChartView: LineChartView!

override public func viewDidLoad()
{
    super.viewDidLoad()

    var valx: [String] = []
    for i in 1..<300
    {
        valx.append(String (i))
    }

    // Do any additional setup after loading the view.
    let xs = Array(1..<300).map { return Double($0) }
    let ys1 = xs.map { i in return sin(Double(i / 2.0 / 3.141 * 1.5)) }
    let ys2 = xs.map { i in return cos(Double(i / 2.0 / 3.141)) }

     let yse1 = ys1.enumerated().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) }
    let yse2 = ys2.enumerated().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) }

    var dataSets : [LineChartDataSet] = [LineChartDataSet]()

    let ds1 = LineChartDataSet(yVals: yse1, label: "Hello")
    ds1.colors = [NSUIColor.red]
    dataSets.append(ds1)

    let ds2 = LineChartDataSet(yVals: yse2, label: "World")
    ds2.colors = [NSUIColor.blue]
    dataSets.append(ds2)

    let data: LineChartData = LineChartData(xVals: valx, dataSets: dataSets)
    self.lineChartView.data = data

    self.lineChartView.gridBackgroundColor = NSUIColor.white

    self.lineChartView.descriptionText = "Linechart Demo"
}

override public func viewWillAppear()
{
    self.lineChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0)
}

@IBAction func ZoomMoins(_ sender: AnyObject)
{
    lineChartView.zoomOut()
}

@IBAction func ZoomPlus(_ sender: AnyObject)
{
    lineChartView.zoomIn()
}

}

i have add two buttons for the zoom + and -

and the result is strange when i zoom

thank you for this fabulous work

PS : GooglTranslate

@liuxuan30
Copy link
Member Author

Just fixed compiler errors for OS X demos.
I don't know what's 'strange'. If you have issues, just open a new one.

@mccpower
Copy link

mccpower commented Sep 8, 2016

Thanks guys for the updates, I don't know if it's a local problem but it seems like the delegates are not being called since I integrated v2.3 any suggestion?

@thierryH91200
Copy link
Contributor

Le 8 sept. 2016 à 12:02, Xuan notifications@github.com a écrit :

Just fixed compiler errors for OS X demos.
I don't know what's 'strange'. If you have issues, just open a new one.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #1291 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AF9jxxrYUMBT9P-N4NNc0SnjHzeCpwvGks5qn908gaJpZM4JdQ_w.

you dont use the same entry in your demo than me for
you use

data.addDataSet(ds2)
let data = LineChartData()
self.lineChartView.data = data =>>

public override init()
{
super.init()
}

and me

let data: LineChartData = LineChartData(xVals: valx, dataSets: dataSets)
self.lineChartView.data = data =>>>>

public override init(xVals: [String?]?, dataSets: [IChartDataSet]?)
{
super.init(xVals: xVals, dataSets: dataSets)
}

this is not the same thing

have you test my example ??? in the ChartsDemo-OSX

public class LineDemoViewController: NSViewController
{
@IBOutlet var lineChartView: LineChartView!

override public func viewDidLoad()
{
    super.viewDidLoad()

    var valx: [String] = []
    for i in 1..<300
    {
        valx.append(String (i))
    }

    // Do any additional setup after loading the view.
    let xs = Array(1..<300).map { return Double($0) }
    let ys1 = xs.map { i in return sin(Double(i / 2.0 / 3.141 * 1.5)) }
    let ys2 = xs.map { i in return cos(Double(i / 2.0 / 3.141)) }

     let yse1 = ys1.enumerated().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) }
    let yse2 = ys2.enumerated().map { idx, i in return ChartDataEntry(value: i, xIndex: idx) }

    var dataSets : [LineChartDataSet] = [LineChartDataSet]()

    let ds1 = LineChartDataSet(yVals: yse1, label: "Hello")
    ds1.colors = [NSUIColor.red]
    dataSets.append(ds1)

    let ds2 = LineChartDataSet(yVals: yse2, label: "World")
    ds2.colors = [NSUIColor.blue]
    dataSets.append(ds2)

    let data: LineChartData = LineChartData(xVals: valx, dataSets: dataSets)
    self.lineChartView.data = data

    self.lineChartView.gridBackgroundColor = NSUIColor.white

    self.lineChartView.descriptionText = "Linechart Demo"
}

hardcopy

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 9, 2016

@thierryH91200 you should not post lots of code here.. just highlight some.
From what you post it's like you are talking about swift 2.3 + Chart 3.0, which is Swift 2.3 branch. There is also a swift2.3-Chart2.2.5 branch, which is based on Chart 2.2.5.

BTW, check #1421, I found a zoom issue for linear line chart, is this what you ask? I had a fix for it, but need more discussion about the details, you could use the fix first.

@ericjsalazar
Copy link

Looking forward to a version compatible with Xcode 8. Thanks in advanced.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 18, 2016

sorry a busy weekend.. @danielgindi where are we? Be sure to check out the open issues I mentioned while converting to swift 3.0. The current swift 3.0 branch solved them but may not be ideal.

BTW, is there any way to put this thread on top? It's in second page and seems people can't even do a simple search to find this

@danielgindi
Copy link
Collaborator

Did you take a look at master? That's after correctly converting everything to Swift 3.0 :-)
Didn't see any bugs resulting from the conversion - but will be happy to hear your feedback!

@UberJason
Copy link

If I'm reading everything correctly, Charts 2.2.5 is now officially in Swift 3, but Charts 3.0 is not yet in Swift 3 - is that right? Do you guys have a rough idea of when it will be? No pressure, would just be great to have an idea. Thanks!

@danielgindi
Copy link
Collaborator

Charts 3.0 is now officialy in Swift 3.0.

When I, @liuxuan30, @petester42 or anyone else here will have the time and energy to make a clean conversion of the old 2.2.5 to Swift 2.3, to have an intermediate release for Swift 2.3 users, then it will happen :-)

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 19, 2016

@UberJason

What branch to use?

Swift 2.3 + Charts 2.2.5 -> Chart2.2.5-Swift2.3 branch
Swift 3.0 + Charts 2.2.5 -> Swift-3.0 branch
Swift 2.3 + Charts 3.0 feature ready -> Swift-2.3 branch
Swift 3.0 + Charts 3.0 feature ready -> Master
The branch name is a little confusing due to historical reasons.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 19, 2016

@danielgindi can we close swift issues now? Swift 2.3 is much easier to convert, @petester42 is fixing some test cases so should be fine.

@UberJason
Copy link

That's an awesome clarifying list, thank you!

@danielgindi
Copy link
Collaborator

Yeah I guess so. We need to cleanup the issues and make things clear for the users...

@UberJason
Copy link

Maybe you can post that list of branches and what versions they correspond to directly on the front page README, that would probably clear up confusion?

@ericjsalazar
Copy link

Thank you for all the work you've done to get it to work with Swift 3.0. However, I'm slightly new to programming and I'm having trouble understanding the bridging header. How exactly do I import my bridging header to use Swift with my Objc project? Thank you!

@liuxuan30
Copy link
Member Author

@ericjsalazar follow ChartsDemo, like import YouAppName-Swift.h

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 20, 2016

@ALL I have renamed the branch:

Swift 2.3 + Charts 2.2.5 -> Chart2.2.5-Swift2.3 branch
Swift 3.0 + Charts 2.2.5 -> Chart2.2.5-Swift3.0 branch
Swift 2.3 + Charts 3.0 feature ready -> Chart3.0-Swift2.3 branch
Swift 3.0 + Charts 3.0 feature ready -> Master

@liuxuan30
Copy link
Member Author

I guess we can close this :) Just refer this issue for any swift 2.3/3.0 issues or information. New bugs should be a new issue and fix only in master (maybe Chart3.0-Swift2.3 will get some love)

@viraf
Copy link

viraf commented Sep 20, 2016

@liuxuan30 I just pulled changes from the master branch but it shows that Charts version is still at 2.2.5

@Huang-Libo
Copy link

Huang-Libo commented Sep 20, 2016

@viraf
Maybe it's caused by your incorrect git Operations。
You can try to clone it again.

@viraf
Copy link

viraf commented Sep 20, 2016

@Huang-Libo I just deleted the repo on my machine and redownloaded it still shows Charts version 2.2.5
charts

@Huang-Libo
Copy link

Huang-Libo commented Sep 20, 2016

@viraf
Oops, you should have downloaded the latest version, only the version number has not been changed, because v3.0 is not released. I guess.

@viraf
Copy link

viraf commented Sep 20, 2016

@Huang-Libo Thanks. In my opinion, if the v3.0 branch is merged to the master then the version should be bumped to v3.0 irrespective if the v3.0 is released or not. It is confusing for users taking the source from the master branch to distinguish between the two.

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 21, 2016

@viraf master is with Chart 3.0 and Swift 3.0 for sure. It's just too many things to do and missed the version. I merged #1505 for that.

@viraf
Copy link

viraf commented Sep 21, 2016

@liuxuan30 thanks!

@karim-Git
Copy link

karim-Git commented Jan 31, 2017

Hi I am trying to change swift version 2.3 to 3.0 library in previous project.

After removing old files (Swift 2.+) files from project added new files latest version (Swift 3.0).

I am getting error like:

/Users/mac/Documents/Project/Your Notes/Your Notes/Classes/Common/Utilities/RadarGraph/Utils/ChartFill.swift:21:17: Type member may not be named 'Type', since it would conflict with the 'foo.Type' expression

I searched lot of time regarding this. I am unable to get the exact thing.

Someone please help this issue.

Thanks in advance.

@pmairoldi
Copy link
Collaborator

You have 2 types that are called the same thing in the same module. I suggest not copying the files to your project. Copy the project file. It will make things much easier for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests