This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@propertyWrapper | |
class Title { | |
var wrappedValue: UILabel | |
init(text: String) { | |
self.wrappedValue = UILabel() | |
wrappedValue.text = text | |
configureLabel() | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@propertyWrapper class Card { | |
var wrappedValue: UIView | |
init(wrappedValue: UIView) { | |
self.wrappedValue = wrappedValue | |
applyCornerRadius() | |
applyCardShadow() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
import UIKit | |
@propertyWrapper | |
class ImageDownloading { | |
var wrappedValue: UIImageView | |
private var cancellable: AnyCancellable? | |
init(wrappedValue: UIImageView, url: URL?, urlSession: URLSession) { | |
self.wrappedValue = wrappedValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct HomeView: View { | |
let featuredPodcasts: [Podcast] | |
let popularPodcasts: [Podcast] | |
let yourPodcasts: [Podcast] | |
var body: some View { | |
NavigationView { | |
VStack(alignment: .leading) { | |
Text("Welcome to SwiftUI") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New View | |
struct PodcastScrollView: View { | |
var content: [Podcast] | |
var body: some View { | |
ScrollView(.horizontal) { | |
HStack { | |
ForEach(content, id: \.self) { _ in | |
RoundedRectangle(cornerRadius: 22, style: .continuous) | |
.foregroundColor(Color.blue) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Container View | |
struct SomeView: View { | |
var body: some View { | |
VStack { | |
Text("Welcome to our SwiftUI app") | |
.font(.custom("Montserrat-Bold", size: 16)) | |
.foregroundColor(.textBlack) | |
.padding() | |
FeaturedContentView() | |
ArticlesScrollView() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Container View | |
struct SomeView: View { | |
var body: some View { | |
VStack { | |
Text("Welcome to our SwiftUI app") | |
.modifier(CompanyHeaderLabel()) | |
FeaturedContentView() | |
ArticlesScrollView() | |
FooterView() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Container View | |
struct SomeView: View { | |
var body: some View { | |
VStack { | |
Text("Welcome to our SwiftUI app") | |
.companyStyled() | |
FeaturedContentView() | |
ArticlesScrollView() | |
FooterView() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WelcomeView.swift | |
// iOS | |
// | |
// Created by Alex Logan on 30/08/2020. | |
// | |
import SwiftUI | |
struct WelcomeView: View { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Coffee: Hashable { | |
let name: String | |
} | |
class CoffeeStore: ObservableObject { | |
func getCoffee() async -> [Coffee] { | |
Thread.sleep(forTimeInterval: 2) | |
return [ | |
Coffee(name: "Cortado"), | |
Coffee(name: "Flat White") |