Your Second iOS & SwiftUI App

Nov 4 2021 · Swift 5.5, iOS 15, Xcode 13

Part 1: List View Fundamentals

04. SF Symbols

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 03. Models & Views Next episode: 05. Challenge: Book Row

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

OK! We’re ready to start working on the image version that renders a “letter square”. We could make fancy letter graphics from scratch by combining text and shapes and things with SwiftUI, but SF Symbols already has some really nice options for us.

    Book.Image()
  }
}

extension Image {
 
}
extension Image {
  init(title: String) {

  }
}
init?(title: String) {
  init?(title: String) {
  guard let character = title.first else {
      <#statements#>
    }
  }
    guard let character = title.first else {
      return nil
    }
      return nil
    }

    let symbolName = "\(character).square"
  }
    let symbolName = "\(character).square"
    self.init(systemName: symbolName)
  }
let symbolName = "\(character.lowercased()).square"

  struct Image: View {
    let title: String

    var body: some View {
  static var previews: some View {
    Book.Image(title: Book().title)
Book.Image(title: Book().title)
    var body: some View {
      let symbol =
        SwiftUI.Image(title: title)

      SwiftUI.Image(systemName: "book")
      let symbol =
        SwiftUI.Image(title: title)
        ?? SwiftUI.Image(systemName: "book")
        
        .resizable()
?? 🟩.init(systemName: "book")
        ?? SwiftUI.Image(systemName: "book")

      symbol
        .resizable()
  static var previews: some View {
    VStack {
      Book.Image(title: Book().title)
    }
  }
    VStack {
      Book.Image(title: Book().title)
      Book.Image(title: "")
    }
      Book.Image(title: "")
      Book.Image(title: "📖")
    }
  init?(title: String) {
    guard
      let character = title.first🟩,
      case let symbolName = "\(character.lowercased()).square",
    let symbolName = "\(character.lowercased()).square"

    guard UIImage(systemName: symbolName) != nil else {
      <#statements#>
    }

    self.init(systemName: symbolName)
    guard UIImage(systemName: symbolName) != nil else {
      return nil
    }
    guard
      let character = title.first,
      🟩case let symbolName = "\(character.lowercased()).square",
      UIImage(systemName: symbolName) != nil