Skip to content

Instantly share code, notes, and snippets.

View cham-s's full-sized avatar
😌
Learning

Chams cham-s

😌
Learning
  • Learner
  • Paris
View GitHub Profile
// The SwiftUI Lab
// Website: https://swiftui-lab.com
// Article: https://swiftui-lab.com/alignment-guides
import SwiftUI
class Model: ObservableObject {
@Published var minimumContainer = true
@Published var extendedTouchBar = false
@Published var twoPhases = true
// Authoer: The SwiftUI Lab
// Full article: https://swiftui-lab.com/scrollview-pull-to-refresh/
import SwiftUI
struct ContentView: View {
@ObservedObject var model = MyModel()
@State private var alternate: Bool = true
let array = Array<String>(repeating: "Hello", count: 100)
@algal
algal / SwiftLineReader.swift
Last active February 8, 2023 16:14
Read a file one line at a time in Swift
import Darwin
/**
Returns a lazy sequence that returns a String for every line of `file`.
Example 1:
// print all lines from a file
let file = fopen(NSBundle.mainBundle().pathForResource("Cartfile", ofType: nil)!,"r")
for line in lineGenerator(file) { print(line,separator: "", terminator: "") }
fclose(file)