Skip to content

Instantly share code, notes, and snippets.

View SwiftyAlex's full-sized avatar

Alex Logan SwiftyAlex

View GitHub Profile
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.companyStyled()
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.modifier(CompanyHeaderLabel())
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
// 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()
// 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)
struct HomeView: View {
let featuredPodcasts: [Podcast]
let popularPodcasts: [Podcast]
let yourPodcasts: [Podcast]
var body: some View {
NavigationView {
VStack(alignment: .leading) {
Text("Welcome to SwiftUI")
import Combine
import UIKit
@propertyWrapper
class ImageDownloading {
var wrappedValue: UIImageView
private var cancellable: AnyCancellable?
init(wrappedValue: UIImageView, url: URL?, urlSession: URLSession) {
self.wrappedValue = wrappedValue
import UIKit
@propertyWrapper class Card {
var wrappedValue: UIView
init(wrappedValue: UIView) {
self.wrappedValue = wrappedValue
applyCornerRadius()
applyCardShadow()
}
@propertyWrapper
class Title {
var wrappedValue: UILabel
init(text: String) {
self.wrappedValue = UILabel()
wrappedValue.text = text
configureLabel()
}
@propertyWrapper
struct Ubiquitous<T> {
private var key: String
private var defaultValue: T
private var store: NSUbiquitousKeyValueStore
init(key: String, defaultValue: T, store: NSUbiquitousKeyValueStore = .default) {
self.key = key
self.defaultValue = defaultValue
self.store = store
import CoreData
@propertyWrapper
class Fetched<Object: NSManagedObject>: NSObject, NSFetchedResultsControllerDelegate {
private var _fetchedResultsController: NSFetchedResultsController<Object>?
var wrappedValue: [Object] = []
init(context: NSManagedObjectContext = CoreDataService.context, sortDescriptiors: [NSSortDescriptor] = [], predicate: NSPredicate? = nil) {
super.init()
// Setup a fetch request