This repository consist small Xcode project for various UI element used within iOS application. All sample build in such a way that you will get clear idea how to use practically each UI Element within swift based application. You can use this free for personal or commercial use.
- Swift3, Xcode8, iOS10
- iPhone 4s, 5, 5s, 5c, SE, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus and all iPad having iOS9 or iOS10.
- Demo-1: UILabel
- Demo-2: UIButton
- Demo-3: UISegmentedControl
- Demo-4: UITextField
- Demo-5: UITextView
- Demo-6: UISlider
- Demo-7: UISwitch
- Demo-8: UIActivityIndicatorView
- Demo-9: UIProgressView
- Demo-10: UIStepper
- Demo-11: UIImageView
- Demo-12: UIScrollView
- Demo-13: UIDatePicker
- Demo-14: UIPickerView
- Demo-15: UIView
- Demo-16: UIContainerView
- Demo-17: UIVisualEffectView
- Demo-18: UIAlertController
- Demo-19: UIWebView
- Demo-20: UINavigationBar
- Demo-21: UITabBar
- Demo-22: UITableView
- Demo-23: UICollectionView
- Demo-24: UIToolbar
- Demo-25: UISearchBar
- Demo-26: UIStackView - Horizontal
- Demo-27: UIStackView - Vertical
- Demo-28: UITapGestureRecognizer
- Demo-29: UIPinchGestureRecognizer
- Demo-30: UIRotationGestureRecognizer
- Demo-31: UISwipeGestureRecognizer
- Demo-32: UIPanGestureRecognizer
- Demo-33: UIScreenEdgePanGestureRecognizer
- Demo-34: UILongPressGestureRecognizer
- Demo-35: UIPageControl
- Demo-36: Indexed Table View
- Demo-37: Grouped Table View
Sample project that demonstrate how to use Label.
Sample project that demonstrate how to use Button.
Sample project that demonstrate how to use Segmented Control.
Sample project that demonstrate how to use UITextField with delegate, close keyboard when clicked anywhere on the screen, move editing from one text field to next text field when Next button clicked within keyboard.
Sample project demonstrate how to use UITextView that allows multi line editing and support newline character. This demo also shows how to close the keyborad by placing action within UIButton (Note: Return key within keyboard will not close the keyboard for textview becuase return key will add newline "\n" character). Newline character support must for UITextView due it's usage for long text having paragraph, so we must close keyboard by any other way that appropriate.
Sample project demonstrate how to use UISlider within swift based application. It shows how to read slider value and use it for changing font size etc.
Sample project demonstrate how to use UISwitch, set various properties or value for UITextLabel based on UISwitch toggle status.
Sample project demonstrate how to use UIActivityIndicatorView. i.e. How to Start/Stop spinning programmatically and hide it.
Sample project demonstrate how to use UIProgressView. i.e. how to increment progress programmaticaly, reset it etc. Used NSTimer for auto increment progress at certain interval. This example also demonstrate how to use NSTimer practically.
Sample project demonstrate how to use UIStepper for increment counter and font size at run time.
Sample project that demonstrate how to use UIImageView and set ContentMode runtime. (e.g. ScaleToFill
, ScaleAspectFit
, ScaleAspectFill
, Redraw
, Center
, Top
, Bottom
, Left
, Right
, TopLeft
, TopRight
, BottomLeft
, BottomRight
).
Sample project demonstrate how to use UIScrollView. i.e. How to set scroll view content size, content offset, zoom scale etc. It shows how to add UIImageView runtime and set Default, Minimum, and Maximum Zoom scale. It's using UIScrollViewDelegate method for detecting zoom.
Sample project demonstrate how to use UIDatePicker i.e. read date value and assign to label when user change it runtime.
Sample project demonstrate how to use UIPickerView having custom component. It shows how to fillup data within each component using UIPickerViewDataSource and read selected component value at runtime.
Sample project demonstrate how to use UIView and change its property (corner radious, border thickness) runtime using UISlider etc.
Sample project demonstrate how to use UIContainerView to load UIViewController within specific area of the screen. This demo also shows how to show/hide external view via UISegmentedControl and how external view behaves when navigate via bar button.
Sample project demonstrate how to apply Blur and Vibrancy using UIVisualEffectView. It provides three options i.e. Extra Light, Light and Dark.
Sample project demonstrate how to show Alert and ActionSheet using UIAlertController having different action button i.e Ok, Cancel, Yes, No, Delete etc.
Sample projet demonstrate how to load web url within UIWebView component.
Sample project demonstrate how to navigate screen using 'segue', It also shows how to set the title for the destination screen by overriding the prepareForSegue function.
Sample project demonstrate how to implement tab based application flow using UITabBar. Contact screen consist top bar button (Map) that link with "Location Map" screen via segue and navigation controller.
Sample project demonstrate how to use UITableView. i.e. how to display multiple section and fillup data for each. When clicked on particular row, it will pass the selected item name to details view controller and item name displayed accordingly on details screen.
Sample project demonstrate how to use UICollectionView. i.e. Creating custom cell that consist image, change image corner radioous at runtime as when stepper value changed.
Sample project demonstrate how to use UIToolbar. UIToolbar can be used for various action button. This project also demonstrate how to show hide toobar using UIView Animation technique.
Sample project demonstrate how to use UISearchBar to perform keyword search within data set and fillup UITableView accordingly. It is using UISearchBarDelegate to perfom search operation while user type the keyword.
Sample project demonstrate UIStackView usage (horizontal mode) and how to add images runtime within it.
Sample project demonstrate UIStackView usage (vertical mode) and how to add images runtime within it.
Sample project demonstrate how to use UIGestureRecognizer. i.e. how increase counter while tapped on the screen.
Sample project demonstrate UIPinchGestureRecognizer usage. i.e. How to change view scale on pinch.
Sample project demonstrate how to rotate object using UIRotationGestureRecognizer.
Sample project demonstrate how to move object using UISwipeGestureRecognizer i.e. Swipe Left, Right, Up, Down.
Sample project demonstrate how to implement object drag using UIPanGestureRecognizer.
Sample project demonstrate how to detect screen edge swipe (Left, Right etc.) using UIScreenEdgePanGestureRecognizer.
Sample project demonstrate how to detect long press gesture using UILongPressGestureRecognizer. It will put circle at the location where long press detected on the screen.
Sample project demonstrate how to use UIPageControl. This example using gesture recognizer for detecting swipe left or right. i.e. upon swipe gestrure detected, it will change UIPageContol currentPage properties and set appropriate value for current page number label.
Sample project demonstrate how display indexed list within UITableView from array. i.e. first sort product list array, group items based on section and store into dictionary, and fillup data within UITableView accordingly.
Sample project demonstrate how display Grouped + Indexed list within UITableView from array. i.e. first sort product list array, group items based on section and store into dictionary, and fillup data within UITableView accordingly. (Note: This is same as indexed table view example, just change table style property to Grouped.)
Images shown within sample are taken from unsplash and used for demo purpose only. I does not claim ownership over any images or icon used.
SwiftUIDemo is available under the MIT license. See the LICENSE file for more info.