Constains various of my implementations of iOS components that I created to make development more productive and intuitive, and iOS features inspired in big brand apps like Discord
- ApiRequest/NetworkLayer: Generic REST API network layer with mockup response support
// Creates a request that defines how to call an API endpoint
// Executes the call using NetworkLayer which parses the response automatically
networkLayer.execute(request: SomeRequest()) { statusCode, responseModel, message in
// Uses the parsed API response
}
- UITappableLabel: Label allowing portions of text in mid paragraph to be tapped for more functionality
let label = UITappableLabel()
label.numberOfLines = 0
let text = NSMutableAttributedString()
text.append(NSAttributedString(string: "Some static text followed by "))
text.append(NSAttributedString(string: "some link", attributes: [
.foregroundColor: UIColor.systemBlue,
.onTap: {
// Does something when tapped
}
]))
text.append(NSAttributedString(string: " and that is it."))
text.attributedText = a
- VNDocumentCameraScan+Extension: Helper functions to extract text from scanned documents using camera
func documentCameraViewController(_ controller: VNDocumentCameraViewController,
didFinishWith scan: VNDocumentCameraScan) {
// Scans document for text
scan.fullText { scannedText in
// Uses the scanned text
}
}
- UIDynamicTableViewController: A simplified and expressive take on UITableViewController
// Define Descriptor for your UI component before anything
// Define table view layout in a "SwiftUI"-esque manner
// Allows individual cell tapping, individual separator control,
// edit mode, multi-selection, infinite scrolling, refreshing, and more
// Automatically detects new cell types and registers them
sections = [
CollectionSectionDescriptor(
header: UILabelDescriptor(text: "HEADER \(index)"),
items: UILabelDescriptor(text: "row \(index)")
.separated(true)
.editable(true)
.tapListener({ selected in
// Tapped on this cell
})),
UILabelDescriptor(text: "row \(index)")
.tapListener({ selected in
// Tapped on that cell
}))
footer: UILabelDescriptor(text: "FOOTER \(index)")))
]
- UIDynamicCollectionViewController: A simplified and expressive take on UICollectionViewController
sections = [...] // Same as UIDynamicTableViewController
// Define your custom layout using UICollectionViewDelegateFlowLayout as usual
- Menu inspired on Discord iOS App
// Adds menu and uses custom view controllers for the chat and menu sections
let menu = DiscordMenuController()
menu.view.backgroundColor = .darkGray
menu.leftMenuController = DiscordLeftMenuView()
menu.mainController = DiscordChatView()
menu.rightMenuController = DiscordRightMenuView()
window?.rootViewController = menu
Copyright (C) 2022 malulleybovo