Questions tagged [uikit]

UIKit is the infrastructure framework on which all iOS user interface is built

Filter by
Sorted by
Tagged with
2 votes
2 answers
97 views

Building a UITableView with fixed number of cells progammatically

I am building this pet project with UIKit. The App's main goal is to keep track of my daily expenses. The AddExpenseViewController is responsible for capturing user ...
motita's user avatar
  • 21
1 vote
0 answers
86 views

Setting constraints to scale app's UI for consistent display across all iOS devices

For apps which don't have significant layout changes between the iPhone and iPad versions, I usually set the constraints of all UI elements (views, labels etc.) as fractions of the current device ...
Quack E. Duck's user avatar
1 vote
1 answer
649 views

Best way to do Input Validation on Swift/iOS/UIKit

I have the following form that creates a new "activity": For which I want to enforce the following requirements: Name => minimum # of chars: 1; maximum # of chars: 50 Description => ...
Enrique's user avatar
  • 145
4 votes
2 answers
1k views

Better way to provide data to UIKit component from Combine pipeline

Today I'm researching how to provide data to UIKit component when using Combine pipeline. I could see tons of tutorials about how to use SwiftUI + Combine from internet, but not found anyone helpful ...
Zhou Haibo's user avatar
1 vote
1 answer
150 views

iOS: prettify random color for debugging

iOS: prettify random color for debugging I used to use random color to debug, from colors I like ...
dengApro's user avatar
  • 381
2 votes
1 answer
137 views

UITableView, auto locate back at indexPath when user drags it

I have a tableView, which auto locates back at indexPath after user has dragged it. In other words, bouncing the tableView back into its bounds, after user dragged it out. Here is the code: ...
dengApro's user avatar
  • 381
3 votes
1 answer
885 views

Core Data Wrapper

I built a wrapper in Swift to practice CoreData. My question is more general, I hope this is acceptable. I wanted to know whether my implementation of this wrapper is correct or poorly implemented ...
Isaac's user avatar
  • 133
4 votes
1 answer
148 views

"What To Do" App

I am starting to build up my portfolio, so I am starting to build projects whenever an idea pops up in my head. So, I decided to build an app that helps you decide what to do. Basically how it works ...
Mamadou Coulibaly's user avatar
0 votes
1 answer
68 views

Change level button's image

There are 12 buttons, and each of them has 3 options for selecting pictures, depending on the data. It works but I think need a shorter and more intelligent decision. ...
user avatar
4 votes
1 answer
911 views

A helper class for creating icons from a PNG image and colour in Swift

I have made a helper struct in Swift that creates circular icons from a PNG image (a white icon on transparent background) and a background ...
Chris's user avatar
  • 226
3 votes
1 answer
699 views

Adding dragging ability to a UIView using UIKitDynamics

I recently published an iOS control/component called BJDraggable which basically, with a call of a method, enables us to drag a view within its superview boundary. ...
badhanganesh's user avatar
1 vote
1 answer
2k views

Draw grid programatically with borders

I need to draw a grid with some special requirements. My current solution is working but is far away from ideal I guess. Attached you can find the current working solution: Some of my thoughts which ...
dehlen's user avatar
  • 143
1 vote
1 answer
2k views

UIViewController without interfacebuilder

I have a template I've been using with Swift for UIViewController and UIView subclasses without a ...
richy's user avatar
  • 133
1 vote
1 answer
9k views

Proper cellForRowAtIndexPath cell return in Swift

So I have started creating a UITableView with multiple prototype cells. I currently have the below code setup, which works fine ...
Hayden's user avatar
  • 145
3 votes
2 answers
3k views

Extending UITableViewCell to preserve UIView background color when selecting the cell

When a UITableViewCell has subviews with background color set, when setSelected(_: animated:) gets called, all the views are ...
Lescai Ionel's user avatar
1 vote
1 answer
141 views

Factory pattern for image or shape marker [closed]

I'm making a photo marker application and need to make a factory pattern for marker. I think it is not very flexible and overall not good. Would you check my code and suggest what could be improved? ...
kangtaku's user avatar
3 votes
1 answer
3k views

Set a font for a UITextView if the font is nil or not equal to desired font

Main question I am setting a font for a UITextView that is a subview in a custom view. I only set it if the user didn't specify the font size in the Interface Builder. I have the following working ...
Suragch's user avatar
  • 405
4 votes
2 answers
7k views

Removing a subview with a subview from a UIView without memory leaks

I made a custom UITextView for vertical Mongolian writing. It is made by subclassing UIView, which has a subview called ...
Suragch's user avatar
  • 405
10 votes
1 answer
1k views

Blurring an Image

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
nhgrif's user avatar
  • 25.3k
8 votes
2 answers
2k views

iOS Utility methods for UIView

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
nhgrif's user avatar
  • 25.3k
3 votes
1 answer
5k views

Draw an arc based on a given percentage

I wanted to create a class that would allow me to draw an arc representing a percentage of progress, similar to the activity view on the Apple watch. There are various examples which I found helpful ...
Jon's user avatar
  • 53
5 votes
1 answer
370 views

Sierpinski Triangle

I am a Java programmer who recently started learning some Swift. I made an app that displays the Sierpinski triangle and adds triangles if the user pans up, and zooms in and out using the pinch ...
Jared's user avatar
  • 719
10 votes
1 answer
698 views

Finger painting code

I have a very simple view that handles touch events and draws accordingly. It's nothing significant, but it does use a bit more CPU than I would like (35%). Again, it is the bare minimum (<90 lines)...
Josue Espinosa's user avatar
15 votes
1 answer
7k views

IBDesignable UICheckbox

A more up-to-date version of this control can be found on GitHub. One UI control that has always been mysteriously missing from Xcode's interface builder is some sort of checkbox. ...
nhgrif's user avatar
  • 25.3k