Published in DevTechie·1 day agoMember-onlyNew in SwiftUI 4 : PhotosPickerIntroduced in iOS 16 with SwiftUI 4, came the most Swifty way to present photo picker for the app users. Before iOS 16, it was possible to present photo picker with the help of PHPickerViewController from the world of UIKit and by bringing them to SwiftUI world using UIViewRepresentable. Let’s…Swiftui7 min read
Published in DevTechie·4 days agoMember-onlyMVVM in SwiftUIMVVM (Model View ViewModel) is a popular structural design pattern. MVVM puts objects into three groups. Models: Model is used to hold app’s data. Model’s are usually simple structs or classes representing the basic data structure for apps. Models are UI independent. Views: View is the visual element of the…Swiftui3 min read
Published in DevTechie·6 days agoMember-onlyNew in SwiftUI 4 : ImageRenderer for View SnapshotIntroduced in SwiftUI 4 with iOS 16, the new ImageRenderer API lets us take view snapshot as CGImage, NSImage or UIImage. We can use ImageRenderer to export bitmap image data from a SwiftUI view. We do this by initializing the renderer with a view, then render images on demand. We…Swiftui3 min read
Published in DevTechie·Jul 29Member-onlyNew in SwiftUI 4 : TextField in Alert by building ToDo appSwiftUI’s Alert View supports TextField input field now. It’s as easy as adding the TextField view inside the AlertView. We will explore this feature by building a simple ToDo list app. Let’s start with ToDo model. struct Todo: Identifiable { var id = UUID() var title: String var subtitle: String…Swiftui3 min read
Published in DevTechie·Jul 26Member-onlyNew in iOS 16 & SwiftUI : VariableValue in SFSymbolStarting iOS 16 and SwiftUI 4.0, some SF Symbols support variable coloring. With this new addition, we can have different parts filled based on a fractional value between 0 and 1. Let’s take an example to understand this better. …Swift2 min read
Published in DevTechie·Jul 24Member-onlyNew in SwiftUI 4 : Tap LocationSwiftUI 4 added support to track tap location, it’s a CGPoint type which gives us the exact location of a tap. By default, provided location comes from local coordinate system of the view. Let’s create an example where we will create an orange circle which will animate to the tap…Swiftui2 min read
Published in DevTechie·Jul 21Member-onlyNew in SwiftUI 4 : Chart Axis ConfigurationApple Chart’s API gives us access to configuration at the component level. In this article, we will explore options to configure Chart Axis and related components. Let’s explore with an example. We will start with a data structure. struct Workout: Identifiable, Hashable { var id = UUID()…Swiftui6 min read
Published in DevTechie·Jul 18Member-onlyNew in SwiftUI 4 : ChartPlotStyle CustomizationApple’s Chart Framework is fully customizable as we will be exploring chartPlotStyle modifier, which helps us customize plot area of the chart. Let’s work with an example. Data structure: struct Workout: Identifiable, Hashable { var id = UUID() var day: String var minutes: Int } Sample data: extension Workout {…Swiftui3 min read
Published in DevTechie·Jul 16Member-onlyNew in SwiftUI 4 : Charts Framework LegendApple’s new Chart Framework(introduced in iOS 16) comes with many customization options. Today, we will explore customization for chart legend. Let’s get started. Data Structure: struct Workout: Identifiable, Hashable { var id = UUID() var day: String var minutes: Int } Sample Data: extension Workout { static…Swiftui4 min read
Published in DevTechie·Jul 14Member-onlyNew in SwiftUI 4 : Range Chart using BarMark, RectangleMark and RuleMarkRange bar charts are great to plot data points where we have min, max and average values. Range area chart is another way to visualize but today, we will use Apple Charts Framework & SwiftUI 4 to plot weather data on Range Bar Chart. Let’s start with the data structure…Swiftui3 min read