GithubHelp home page GithubHelp logo

iOS 8.0 Support about reusable HOT 6 CLOSED

alisoftware avatar alisoftware commented on July 20, 2024
iOS 8.0 Support

from reusable.

Comments (6)

AliSoftware avatar AliSoftware commented on July 20, 2024

Good point on forEach, didn't know it was iOS9.3+. I thought it was tied to the Swift stdlib, not to iOS version, are you sure it's not compatible with 8+?

NibOwnerLoadable is generally more useful than NibLoadable if you plan to integrate your XIB in another XIB or Storyboard. You'll make your class the File's owner of your MyCustomView.xib, then bind every needed IBOutlet from that File's Owner to the view(s) you put in your MyCustomView.xib to provide content.

Then, the most interesting part of doing that (instead of using NibLoadable and having your class be the root via of the XIB and not the File's Owner) is that if in a Storyboard you add a view and change its class to MyCustomView, it will be of the right class right away, you'll be able to access the MyCustomView IBOutlets from that Storyboard or its IBInspectable properties, and you won't need to load its content by code either (provided that you implemented init(coder:) in MyCustomView.swift to call MyCustomView.loadFromNib(owner: self))

See my example code which I recently improved to give an example of its usage. I plan to rewrite the README and rearrange paragraphs and give more examples to make all that more clear anyway.

from reusable.

gokselkoksal avatar gokselkoksal commented on July 20, 2024

I've just tried forEach on iOS 8.1 simulator and it works. How can I use a function that's available to iOS 9.3+, on iOS 8.1? That's interesting.

I now get what NibOwnerLoadable does, thanks for explanation.

from reusable.

AliSoftware avatar AliSoftware commented on July 20, 2024

As explained, forEach is part of Swift's stdlib and as Swift runtime is dynamically linked that's logical and not surprising it's available on all iOS versions. What made you think it was only available on iOS 9?

from reusable.

gokselkoksal avatar gokselkoksal commented on July 20, 2024

Well, the doc says Availability: iOS (9.3 and later), isn't it confusing? :D

from reusable.

AliSoftware avatar AliSoftware commented on July 20, 2024

Which docs are you referring to?

If you look at the definition of forEach itself (like, Cmd-click on it) you'll see there's no particular @availability attribute there.

If you look at the generated documentation at swiftdoc.org you'll see that this method is present as soon as Swift 2.2

I've seen Xcode's "quick help" tooltip report invalid availability versions in the past (Xcode bug); maybe that was what you were referring to as "the docs says…"?

from reusable.

gokselkoksal avatar gokselkoksal commented on July 20, 2024

Yes, quick help misled me... Thanks for explanation!

from reusable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.