5

I'm working on a project in Xcode6 beta 4 in Swift. But I got a lot of problems on this project which is working fine in Xcode6 beta 3:

Swift is unavailable on iOS earlier than 7.0;

I remembered Swift should work for iOS 6.0 and above. Why suddenly change to iOS 7.0?

Class 'ViewController' has no initialisers

'IBOutlet' property has non-optional type 'UILabel'

So that I have to change my code to:

@IBOutlet weak var label: UILabel!

Will it be changed in next version again?

Another issue is:

'CGColorSpaceModel' does not have a member named 'value'

My code is:

var colorSpaceModel : CGColorSpaceModel
{
    return CGColorSpaceGetModel(CGColorGetColorSpace(self.CGColor))
}


if self.colorSpaceModel.value == kCGColorSpaceModelRGB.value || self.colorSpaceModel.value == kCGColorSpaceModelMonochrome.value {

I don't know what I should do now.

Community
  • 1
  • 1
Bagusflyer
  • 12,675
  • 21
  • 96
  • 179
  • 5
    Where did you hear that Swift works on iOS 6? In [this question](http://stackoverflow.com/questions/24001778/do-swift-based-applications-work-on-os-x-10-9-ios-7-and-lower) you will find many answers saying it works only in iOS 7 and later. – jtbandes Jul 22 '14 at 02:40
  • 1
    Actually I've read this post before. Somebody test it on iOS 6 and it worked fine then. – Bagusflyer Jul 22 '14 at 02:57
  • 1
    Swift is Beta, that means it is incomplete, has bugs and is subject to change. Actually it doesn't quite meet the definition of beta since it is not feature complete yet. If the incompatibilities are a problem do not use it yet. – zaph Jul 22 '14 at 02:59
  • I didn't complain it here. Just discuss (I'll go Apple Dev forum to discuss that too). Isn't that better if Apple support iOS 6 in Swift? I think that's the beta means. To let people find the problem or request new feature.Am I right? – Bagusflyer Jul 22 '14 at 03:18
  • I doubt that Apple is interested in supporting the language that far back for new apps written in Swift. If you want to make your opinion known file a bug, that is the only way: [Bug Reporter](http://bugreporter.apple.com). – zaph Jul 22 '14 at 03:22
  • 2
    Apple has always said that Swift only supports iOS 7 and OS X 10.9 or better. Don't rely on undocumented features. They also just announced that iOS 7 is at 90% adoption. – Chris Wagner Jul 22 '14 at 03:33
  • Take a look at xCode 6 Beta 4 Release Notes: `The Swift compiler and Xcode now enforce a minimum deployment target of iOS 7 or OS X Mavericks. Setting an earlier deployment target results in a build failure.` So they explicitly sated minimum deployment targets. – Keenle Jul 22 '14 at 07:51
  • They've never claimed it would run on anything earlier than iOS 7. This is directly from Dave DeLong, the day after the announcement of Swift. http://stackoverflow.com/a/24007171/716216 – Mick MacCallum Jul 22 '14 at 08:30
  • Why are you even targeting iOS 6 .... ? – CW0007007 Jul 22 '14 at 15:53

1 Answers1

0

Yeah, it's beta - so don't expect stability :)

  • IBOutlet - Click on the red circle and choose how to fix it (read about inferred and optional types before)

@IBOutlet issue

  • Class 'ViewController' has no initialisers - This should fix it

    init(coder aDecoder: NSCoder!) { super.init(coder: aDecoder) }

  • colorSpaceModel - The API updated

try

if (self.colorSpaceModel == kCGColorSpaceModelRGB)
Vasile Cotovanu
  • 1,510
  • 2
  • 11
  • 13