30-iOS-swift-projects-in-100-days
30-iOS-swift-projects-in-100-days copied to clipboard
30 iOS projects with Swift in my next 100 days
30-iOS-swift-projects-in-100-days
30 iOS projects with Swift in my next 100 days(next server months or years maybe)
22.Simple Game With SpriteKit
Date: 2018-5-26

What I learned from this demo:
- Try to build iOS game with
SKView,GameSceneinSpriteKit - Use the simple physic system such as collision test in game
- Overload basic operators of
CGPointin Swift
21.Keychain for Security
Date: 2018-5-6

What I learned from this demo:
- Use
Keychiansource code for security in swift - New keywords in swift:
throws,whereclause in extension,enumin class,UserDefaultsandUIDevice
Resource: GenericKeychain
20.CocoaPods in iOS
Date: 2018-4-27

What I learned from this demo:
- Try CocoaPods in AppCode, edit pod file and install the specified pod:
MBProgressHUD - Use sleep method of
ThreadwithDispatchQueueto simulate long-time-process
PS: While I use CocoaPods in AppCode, even though the pod is installed but I cannot use it, everything ends with this error: No such module 'MBProgressHUD'. At last I fix this problem after searching on website:
- Open project (the .xcworkspace file) in XCode
- Open menu: Product - Scheme - Manage Schemes, only check the Pods item and click Close button
- Click menu: Product - Build
- Return to AppCode, and this time even thought the error is still there but the code assistant works fine, leave it, just build and run, it works!
That's all, why it happens? I got no idea.
19.Tabs with Controllers
Date: 2018-2-15

What I learned from this demo:
- Work with
UITabBarController, and the controllers embed withUINavigationController - Implement the
UITextFieldDelegateprotocol to monitor the changes of text content - The basic map view in controller setup, set location in simulator, make annotation in view
18.Line Drawing View
Date: 2018-2-14

What I learned from this demo:
- Touch event handle in
UIResponderwith multiple pointers, and super view - Basic graphic in
UIView, draw lines with path, stroke, width and color - Use
@IBInspectableto make properties visible inStoryboardsettings panel - Clip the view and save to image file, show the hidden toolbar in navigation
17.Walkthrough Pages
Date: 2018-2-7

What I learned from this demo:
- Work with protocals:
UIPageViewControllerDelegateandUIPageViewControllerDataSourceto buildUIPageViewController - Use
NSLayoutConstraintto do the animation of controls - Instantiate view controllers by
UIStoryboard
PS. This project supports one solution to the animation problems in the previous project: 10.Basic Animation by using the NSLayoutConstraint in layout.
16.Flickr Recent Photos
Date: 2018-1-26

What I learned from this demo:
- Deal with the errors in Swift with
enumtypes andErrorprotocol - Solve the problem of wrong image place in
UIImageViewwhile reuse the cells in table view - Save image file to file system with
UIImageJPEGRepresentationandFileManager - Use
UIActivityIndicatorViewto preload images
15.Json Data Presenter
Date: 2018-1-24

What I learned from this demo:
- Load
jsondata from server and parse it to local data class - Work with
URLRequest,URLQueryItemandURLComponentsto fetch network data - Initialize data in
AppDelegatethrough view controller
PS: For the reason of reusable of cells, the image will not be correctly presented in the expected UIImageView, but I have solved this in my next app.
14.Save Data To File
Date: 2018-1-20

What I learned from this demo:
- Create object with
NSObjectandNSCodingprotocol - Save encoded object to local file with
FileManagerandNSKeyedArchiver - Understand the basic knowledge of the app's life circle
- Work with
Date,DateFormatter,tableView.deleteRows, andeditButtonItem
13.Pure Code App
Date: 2018-1-18

What I learned from this demo:
- Delete and get rid of the storyboard, just add code in
AppDelegateto install views - Pure code for custom table view cell class, override the
initfunction to do initialization - Add the simple
UILabelto the content view of the table view cell - Code for the simplest constrains(I notice that, you should constrain the label to the
self.viewbut not to the content view!)
12.Simple Image Viewer
Date: 2018-1-15

What I learned from this demo:
- Use the
UIScrollViewwithImageViewto scale image - Simple usage of the
NumberFormatter, and the lazy property definition - Add Tap Gesture Recogizer to the main view in Interface Builder to deal with keyboard dismiss
11.Simple Network Image View
Date: 2017-12-30

What I learned from this demo:
- Load and display image from server by using
URLSession - Deal with the response, data and error of the network connection result
- Switch from net thread to the main thread to control the UI elements through
DispatchQueue
I cannot load image from the non-https URL, so add the property Allow Arbitrary Loads under App Transport Security Settings, set the value as YES.
10.Basic Animation
Date: 2017-12-22

What I learned from this demo:
- The basic animation with the controls in iOS
- Show or hide the navigation bar or bar items in code
- Use computed data or properties in swift
- Understand the method
viewWillAppearandviewDidAppearfor controlling the animation logic
I found a problem that the position of controls in viewWillAppear cannot move, even thought the value is changed! However if you put the code in viewDidAppear then the controls will move, but, the animation looks wried!!! So, I have to hide(set alpha=0.0) and then move them in viewDidAppear, why this happens(the auto layout is not the reason!)?
override func viewWillAppear(_ animated: Bool)
{
super.viewWillAppear(animated)
print(self.labelHeading.center.x) //result is 147.5, all right.
self.labelHeading.center.x -= self.view.bounds.width //no movement happens!
print(self.labelHeading.center.x) //is -227.5, OK, but no changes on the screen, why???
}
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
self.labelHeading.center.y -= self.view.bounds.height //the control moves here!
}
09.Editable Table View
Date: 2017-12-19

What I learned from this demo:
- Change the edit mode in
UITableView, use the methodsetEditing(_, animated:) - Rearrange the table view cell items in edit mode
- Dynamicly change the title of the bar button item
- Add text filed to the alert, and deal with the text result
08.Basic Collection View
Date: 2017-10-21

What I learned from this demo:
- Work with collection view, within more than one columns
- Delete items in collection view through
UILongPressGestureRecognizerandUIAlertControllerandIndexPathin collection view - Extension with
UICollectionViewDelegateFlowLayout, override the important optional methods - Try to use circular images in code:
cell.imageTitle.layer.cornerRadius = cell.imageTitle.bounds.height * 0.5
cell.imageTitle.clipsToBounds = true
07.Pull To Refresh Table View
Date: 2017-10-14

What I learned from this demo:
- Add refresh control to achieve pull-to-refresh and reload data in table view
- Override
numberOfSections(in : UITableView)function to change the default appearance of empty table view - Set title and add navigation bar items in swift code
06.Photo Picker
Date: 2017-10-05

What I learned from this demo:
- Work with static cells in static table view
- Use container view (UIContainerView) to embed other view
- Specify user permissions in the Info.plist file
- Deal with the focus of UITextField, with
becomeFirstResponder()and the implementation ofUITextFieldDelegateprotocol, returntrueintextFieldShouldReturn(_ textField: UITextField) -> Boolmethod - Try to use camera and photo library with image picker
05.Detail Table View
Date: 2017-09-03

What I learned from this demo:
- Pass data from one view to another through segue
- Work with custom view controller and embed them in the navigation controller
- Customize the swipe action menus of table view cells
- Multiple lines for
UILabel(set lins to 0 in storyboard), customize the navigation bar item (the code should be placed in mainViewController, not the detail view controller), and remove the blanks between top bar and table view (uncheck the Adjust Scroll View Insets in view controller)
04.Basic Table View
Date: 2017-09-02

What I learned from this demo:
- Basic table view and the simple custom cell
- Display local data, add or edit local data and refresh the table
- Use
UIAlertControllerwith text field and deal with the response of alert actions - Change the constrains of the table view in the view container by storyboard
03.Tip Calculator
Date: 2017-08-26

What I learned from this demo:
- Swift extensions, double to string format, computed values
- Multiple stack view to build more flexible layout
- Use the slider, and give it the value change response handler
- Add custom UIToolBar to the number keyboard, set clear button and keyboard type
- Deal with the focus of UITextField, and enable or disable the other elements
02.Tap Hold Counter
Date: 2017-08-20

What I learned from this demo:
- Swift property delegations: willSet/didSet
- Detect Tap and Long Press Gestures on buttons
- Multiple actions on one button:
addGestureRecognizer
01.Tap Counter
Date: 2017-08-17

What I learned from this demo:
- Build a basic interface with Button/Label/NavigationBar/BarButtomItem
- AutoLayout basics: Stack View and Constrains
- The keywords: @IBOutlet/@IBAction/weak
- I now upload the projects to Github via git on my Macbook
What inspires me is the project: 100 Days of Swift