Are Text View and Image View the only Options for UI?

I'd like to create a circle and manipulate it, as SPCCore allows on Swift Playgrounds Shapes, but have yet to find an alternative outside that book.

Should I use Image View as a circle? Or is there a third View option, such as Shapes View?

There is a "Shape", as well as "Path". These are documented in Xcode's docs. You can also find them on the web by searching for SwiftUI Drawing and Animation.

These aren't part of Swift in and of itself, though, but part of libraries supplied by Apple.

1 Like

Are they Core Libraries? I'm trying to learn UIKit first -- is that a Core Library?

Sorry, I'm really new to Swift, just started in the summer with Swift Playgrounds and am now going through the Developing in Swift series.

So, a bit of tricky nomenclature, Apple has a bunch of libraries which they call "Core" something or other, which are are good, solid libraries, but written in C++ or C, and therefore in a not Swifty style (especially since Swift didn't exist when they were written). Many are "Bridged" into Swift via other libraries. For Instance, Core Graphics is (maybe) totally covered in UIKit and AppKit.

I'd suggest the libraries you really want to understand would be the Swift Standard Library, which come with Swift; Foundation, which extends and augments the SSL and is installed with Swift (import Foundation); UIKit itself; and of course SwiftUI itself.

After, please consider skimming the rest of the Apple Developer Documentation

And of course, a great place to find answers to questions which arise in your studies would be here in this forum if it's about the Swift Language itself or the Standard Library, but for the various other libraries, you might look at Stack Overflow, with some appropriate tag, such as SwiftUI.

2 Likes

Thanks! I'm coming from a JavaScript background, and am finding the navigation of the Swift world much more difficult. This helps a lot!

For the purposes of the Swift project, the “core libraries” refer to Foundation, Dispatch, and XCTest. These are libraries that Apple has made available cross-platform. It’s not related to any Apple-proprietary frameworks, whether or not they’re named “Core.”

3 Likes

Thanks, I wasn't sure if Core Animation and Core Graphics were part of it. Nor am I familiar with Core Data since I haven't used a database yet with a Swift application.

I'll study Foundation, Dispatch, and XCTest. Thanks again!

I’m not sure I understand why you are specifically studying the core libraries.

On Apple platforms, the “core libraries” (i.e., cross-platform, open source) implementations of Foundation, Dispatch, and XCTest aren’t used—instead, Apple’s proprietary versions are shipped with the OS. In other words, on Apple platforms, you wouldn’t be using any core libraries at all.

@xwu
Thanks for the feedback. You're right, it's off. I'm learning Swift by trial and error -- mostly error. What do you mean 'proprietary versions'? I'm just really confused as to how to navigate the Swift world. How did you get grounded in the language and its use?

There are two classes of "core" libraries that are used in Swift iOS,macOS, el al, applications. There are the "core" libraries (Core Graphics, Core Animation, Core Data, etc.) associated with the Apple proprietary frameworks AppKit/UIKit, SwiftUI, and Combine. Then, there are the open-source libraries associated with the Swift environment (Foundation, Dispatch, XCTest). AppKit/UIKit/SwiftUI/Combine only exist for Apple platforms, although there have been various efforts to reverse-engineer these frameworks to run on other platforms.

The nuance mentioned in this thread has to do with the Apple implementations of Foundation, Dispatch, and XCTest. These frameworks on Apple platforms pre-date the creation of the Swift compiler environment by several years, back to the '70s and '80s if you include the heritage OpenStep code used with NeXT computers. They are used on Apple platforms instead of the open-source equivalents because they provide additional functionality not currently implemented in the open-source versions, and also support Objective-C/Objective-C++/C/C++ based applications. These original implementations are proprietary to Apple and also only exist on Apple platforms.

The open-source versions are used for Linux, FreeBSD, Windows, and other operating system environments. They mimic the Apple APIs but, are implemented using operating system interfaces appropriate to each platform (Linux, FreeBSD, Windows, etc.),

1 Like

Having spent last 25 years working in a macOS environment gets you familiar with the Apple development architecture!

Also, the Apple developer documentation site has a bunch of information that Apple developers need to be familiar with. In particular, in developer.apple.com/library/archive is a series of concept documents that explain the architectural concepts. In this realm, Swift is just one language among many used to build Apple applications. There is also links to the specific current documentation for the frameworks, Xcode, libraries, etc..

For open-source Swift, swift.org is a good starting point, however there are many references to the Apple documentation site and its Swift links.

1 Like

@jonprescott Thanks so much! I'd heard of NeXT before, and seen one in a picture of Tim Berners Lee's first server for the www, but had no idea OpenStep ran on it or was foundational for current iOS development.

I'll pore over the Apple Developer docs and Swift's site. Thanks again!

Terms of Service

Privacy Policy

Cookie Policy