For an iOS app I use the Charts library from Daniel Gindi. I am currently migrating from UIKit to SwiftUI and would like to use iOS Charts from Apple which is available from iOS 16 onwards. The app targets iOS 15 + which forces me to keep Daniels Charts library also.
So basically I have two modules with the same name and concerning import statements cannot differentiate between the two. What can I do?
Module aliases we’re added 5.7 which exactly handle this situation.
Related
If I'm building a framework A and import Reachability, maybe via Carthage of Swift PM, although the app using framework A would never be able to use A.Reachability, import Reachability still appears in interface of final built of A.
How to avoid this?
Swift doesn't support internal/private imports at the moment. All of your imports are forwarded to anyone using your framework. If you look at Foundation for example it pulls in a lot of other frameworks such as GCD and Darwin.
If you need to hide it then you are currently limited to copying the code into your framework and making sure it is all internal/private so people importing your framework don't see it.
UIKit and AppKit still share a lot of concepts. Like in "AppKit contains all the objects you need to implement the user interface for a macOS app—windows, panels, buttons, menus, scrollers, and text fields" (by Apple documentation). And same UIKit is support the user interface. So what's the main difference between these two framework.
AppKit
AppKit is included in the OS X SDK only. It provides all the classes and controls you need for creating Mac applications. Most of these classes share a common naming prefix starts with NS and classes you will be working with include - NSView, NSButton.
UIKit
UiKit is the framework that iOS uses to provide its UI and its classes start with a UI prefix. For example, both frameworks have a class to represent color include UIColor, while other concepts are pretty unique to UIKit, such as its use of predefined controllers such as UINavigationController and UITabBarController
AppKit is much older and was developed for desktop machines, like Macintosh (Mac OS X) and (before that) NeXT.
UIKit is later, a deliberate reduction and rationalization of AppKit, developed for iPhones (iOS).
Appkit is for Mac OS SDK[Cocoa] and UIKIT is for iPhone/iPad [Cocoa Touch]
They are the same UI framework except that UIKit's views and controllers were specifically made for touch, while the AppKit equivalents were specifically made for the mouse or non touch .
I'm beginner swift developer. Just for a week now I've been trying to implement some kind of chart into my app. I know Swift 4 and Xcode 9 are already out but I'm still using Swift 3 and Xcode 8. I've read a lot of tutorials and different pages but still I'm not able to find any working ones. All examples are either too old or for swift 4. I've learned about using Cocoapods and other frameworks such as Firebase or Alamofire work just fine.
Please let me know if you can help me with finding some chart library that actually works as it is supposed to.
To get things materialistic and kick off, for building charts in iOS try Charts library. One of the best third-party libs out there.
Or check this list for even more awesome iOS charts libraries.
I have multiple static iOS libraries (Objective-C) that I would like to add module support to.
By that I mean the use of #import statements instead of needing to use a bridging header to support swift.
Facebook, and Parse have recently added this feature to their SDKs but I can't find any documentation as to how they did it. Keep in mind that these SDKs STILL target iOS 7 so they are not simply dynamic frameworks (which would only support iOS8).
Can anyone explain exactly how I can go about doing this?
I would like to support both iOS 7 and iOS 8 if possible. I am writing the app in Swift. When setting up Core Data, I found out that you have to namespace your classes in your data model. Otherwise the class isn't found (i.e. Target.Class vs Class). Requiring a namespace here is an issue for a couple of reasons. One, it means you can't use your data model in different targets (including testing targets), and two, it breaks in the opposite direction in iOS 7. iOS 7 looks for Class but the data model now has Target.Class.
Does anyone know the appropriate way to support both iOS 7 and iOS 8 in this situation? I've run into other areas where the namespacing has caused issues.
Adding the #objc tag to your custom class declaration will have the additional affect of moving it into the default namespace, which has no mangling so is usable from both iOS 7 and 8.