#UITextField
Explore tagged Tumblr posts
msicc · 1 year ago
Text
How to modify the border of a .NET MAUI Entry on iOS and MacCatalyst
I just blogged: How to modify the border of a #dotNET #MAUI Entry on #iOS and #MacCatalyst In this post, I will show you how to modify the #Handler to take control over the #Entry’s border by changing the underlying native control. #iOSDev
In my recent side project, TwistReader, I needed to modify the Border of an Entry to match my application’s primary color. The .NET MAUI Entry does not provide a direct way to change the color of the border, however. Luckily, it isn’t that difficult to change the color of the border, nonetheless. Modifying the mapping of the native control The .NET MAUI Entry renders to a native UITextField.…
Tumblr media
View On WordPress
0 notes
elgringo300 · 10 months ago
Text
Matlab Game Engine Devlog
8/14/2024:
Defined the uitextfield and its callback in the START function instead of in the GameLoop
Defined Window.UserData and used waitfor() function to make the GameLoop wait until Enter key is pressed and input is received. 
Notes: It currently only takes text inputs. In the future, if I want it to take arrow key inputs or mouse click or anything else, I will have to define new callbacks.
3 notes · View notes
fromdevcom · 3 months ago
Text
The iOS soft keyboard is a crucial component of many iOS apps, allowing users to enter text and interact with the app. However, in certain situations, you may need to programmatically hide the keyboard to improve the user experience. This could be because the user has finished entering text and no longer needs the keyboard, or because the app needs to perform an action that requires the keyboard to be hidden. In this article, we'll explore how to programmatically hide the iOS soft keyboard using Swift. We'll cover two methods: using the resignFirstResponder() method on the active UITextField or UITextView object, and calling the endEditing(_:) method on the view controller to end editing on the current view and hide the keyboard. You can programmatically close/hide the iOS soft keyboard using the resignFirstResponder() method of the active UITextField or UITextView object. Here's an example code snippet: // Assume that textField is a UITextField object textField.resignFirstResponder() This code will hide the soft keyboard if it is currently being displayed for the textField object. Alternatively, you can also call endEditing(_:) method on the view controller to end editing on the current view and hide the keyboard. This method resigns the first responder status for the view, which causes the keyboard to be dismissed. This code will hide the soft keyboard if it is currently being displayed for the textField object. Alternatively, you can also call endEditing(_:) method on the view controller to end editing on the current view and hide the keyboard. This method resigns the first responder status for the view, which causes the keyboard to be dismissed. // Assume that self is a view controller self.view.endEditing(true) This code will dismiss the keyboard for the current view controller, regardless of which text field or text view is active. In conclusion, programmatically hiding the iOS soft keyboard can be achieved through two methods: using the resignFirstResponder() method on the active UITextField or UITextView object, or calling the endEditing(_:) method on the view controller to end editing on the current view and hide the keyboard. Both methods are available in Swift 2.0 and later and can be used with iOS 7.0 and later. However, it's important to note that different iOS versions may have slightly different behavior when it comes to hiding the keyboard, so you should test your code on different versions to ensure it behaves as expected.
0 notes
neatocode · 3 years ago
Text
Scheduling Work in Swift using `NSTimer`
NSTimer can be used to perform scheduled work in Swift. Sometimes it is simpler than other options like GCD (Grand Central Dispatch) or NSOperationQueue, particularly if what you are scheduling needs to run on the main UI thread to access UIView instances anyway. There are also more options coming in the future such as Actors.
Here is an example of using NSTimer running a block of code five times, one second apart:
import Foundation import PlaygroundSupport import UIKit let maxRepeats = 5 var currentRepeats = 0 let blockTimerWith5Runs = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in currentRepeats += 1 print("Block ran \(currentRepeats) times(s)!") if (currentRepeats >= maxRepeats) { timer.invalidate() } }
In an iOS app, RunLoop.main will already be running. In XCode playgrounds you also need:
RunLoop.main.run(until: Date(timeIntervalSinceNow: 6))
Output:
Block ran 1 times(s)! Block ran 2 times(s)! Block ran 3 times(s)! Block ran 4 times(s)! Block ran 5 times(s)!
It can also be used to run a function:
class FunctionTimerExample { init() { Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.peep), userInfo: nil, repeats: false) } @objc func peep() { print("Function ran once!") } } let functionTimerExample = FunctionTimerExample() RunLoop.main.run(until: Date(timeIntervalSinceNow: 2))
Output:
Function ran once!
The function can optionally receive the Timer itself as an argument with some user info attached:
class Counter { var count : Int init(_ count: Int) { self.count = count } } class FunctionTimerWithArgExample { init() { let userInfo = Counter(0) Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.peepArg), userInfo: userInfo, repeats: true) } @objc func peepArg(timer: Timer) { guard let userInfo = timer.userInfo as? Counter else { return } userInfo.count += 1 print("Function with arg ran \(userInfo.count) time(s)!") if (userInfo.count >= maxRepeats) { timer.invalidate() } } } let functionTimerWithArgExample = FunctionTimerWithArgExample() RunLoop.main.run(until: Date(timeIntervalSinceNow: 6))
Output:
Function with arg ran 1 time(s)! Function with arg ran 2 time(s)! Function with arg ran 3 time(s)! Function with arg ran 4 time(s)! Function with arg ran 5 time(s)!
An example use case is debouncing a search input
class DebouncedSearchViewController: UIViewController { var textField = UITextField(frame: CGRect(x: 20, y: 20, width: 200, height: 24)) var timer : Timer? override func viewDidLoad() { super.viewDidLoad() view.addSubview(textField) textField.placeholder = "Enter search" textField.backgroundColor = .green self.textField.addTarget( self, action: #selector(self.textFieldDidChange(textField:)), for: .editingChanged); } @objc func textFieldDidChange(textField: UITextField){ print("Text changed: " + textField.text!) timer?.invalidate() timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: false, block: { _ in guard let text = textField.text else { return } print("Submit debounced search query for: \(text)") }) } } let vc = DebouncedSearchViewController() vc.view.frame = CGRect(x: 0, y: 0, width: 300, height: 300) PlaygroundPage.current.needsIndefiniteExecution = true PlaygroundPage.current.liveView = vc.view
Demo of typing `ABC` quickly followed by `Z` after waiting for a second:
Tumblr media
At one company I worked at, we found having a 500ms debounce instead of 200ms reduced the number of network calls, and thus reduced operational costs, without impacting user engagement. So there are debounce values you can use that will save things like cost, network bandwidth, and battery life without hurting user experience.
Warning: If doing some blocking operation like networking or file IO, make sure to start the timer off the main thread, or create a different run loop and add it to that run loop manually. Everything above runs on the main UI thread, so could lock up the user interface on the user if blocking operations were added.
2 notes · View notes
yogeshpatelios · 5 years ago
Video
youtube
Swift 5 & Xcode 11 : UIDatePicker as inputView to UITextField With UIToo...
0 notes
script-ease · 7 years ago
Link
0 notes
learning2code · 6 years ago
Photo
Tumblr media
PROJECT: BOOKHOUSE APP
HELLO! I know it’s been a while since I have posted anything, but it isn’t without a good reason. The photo in this post is an app that I have been coding using IOS swift. Of course, it does not do very much at the moment, but for a brand-spanking-beginner to coding, I am quite proud. The code that it took to make this is quite long and definitely needs some refining, but for purposes of showing what I have learned, I will show a snippet of the code below and explain the elements of certain lines of code as best as I can (being super new to this, my verbiage may not be 100% accurate).
So as you have seen (in my previous blog post), I practiced and learned about loops. During this time I came across arrays, what use they have, and how they may be implemented into a coding system. Below is my code for the text field “Publisher” and the Function for validating the text in the text field using an array.
let publishField: UITextField = {
       let publishtextField = UITextField()
       publishtextField.placeholder = "Publisher"
       publishtextField.backgroundColor = UIColor.lightGray
       publishtextField.textColor = UIColor.purple
       return publishtextField
publishField.frame = CGRect(x: 20, y: authorField.frame.maxY + space, width: 200, height: 44)
       publishField.delegate = self
       self.view.addSubview(publishField)
}
   func textValueCheck(for text: String) -> Bool {
       let characters = Array(text)
       let validCharArray = Array("abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
       for char in characters {
           if !validCharArray.contains(char) {
               return false
           }
       }
       return true
   }
The first block of code, is allowing the publish textfield to be a part of the UITextField that we then define through the text field’s name, color, text color, and frame dimensions/location within the UIView. The second block of code is implementing a function to check the value of the text within the text field. It is defined as a string of text that will have a boolean operation. We then define the variable characters as an array of text. We demand that a valid character array contain the string of letters within the quotation marks. We then state that for the characters within the text field, if they are valid characters, we will accept the text. Otherwise, should the characters not be valid, we will not.
More to come!
1 note · View note
appinessweb · 3 years ago
Text
How to Build a Login Screen in SwiftUI
In WWDC 2019 Apple announced a completely new user interface development framework called SwiftUI. SwiftUI is a user interface toolkit that lets us design apps in a declarative way. There was lots of talk about whether we should use Storyboard or build UI programmatically. SwiftUI is the answer to all these questions. You can now develop the app's UI with a declarative Swift syntax.
No more storyboard, Interface Builder and Auto-layout
Earlier we used to develop user interfaces with storyboards, xib's and auto layout. But with SwiftUI, storyboard and auto-layout are completely out of the picture. Now the code editor is available with a preview canvas.
Migrating from UIKit to SwiftUI
If you've used UIKit before then you need to understand what's the UIKit component equivalent in SwiftUI. Many of the classes you know just by removing prefix UI but few have been renamed. Let's have a look at the list.
1. UIViewController: View
2. UITableViewController: List
3. UITabbarController: TabView
4. UINavigationController: NavigationView
5. UIAlertController: Alert
6. UIAlertController with style .actionSheet: ActionSheet
7. UILabel: Text
8. UITextField: TextField
9. UITextField with secure entry: SecureField
10. UISwitch: Toggle
11. UISlider: Slider
12. UIButton: Button
13. UIStackView with horizontal axis: HStack
14. UIStackView with vertical axis: VStack
15. UIImageView: Image
16. UISegmentedControl: SegmentedControl
17. UIStepper: Stepper
18. UIDatePicker: DatePicker
19. UIPickerView: Picker
20. UITabbar: TabView
21. UINavigationBar: NavigationView
22. UIScrollView: ScrollView
Creating Project:
Step 1 - Creating a new project with SwiftUI
Step 2 - Add the VStack in the View. It will act as Vertical StackView
Step 3 - Add title text as Login in the View and can set style to the Text.
Step 4 - Adding Image to the top of the Screen to show that its user's login and adding frame of width and height as shown below.
Fig 1 - Adding Image and Text
Step 5 - Adding Text Field for Phone Number and password with TestField and SecureField inside the VStack and Alignment to leading.
Step 6 - Adding placeholder to the textfield , Add Text and Value will be saved in the Variable.
Step 7 - Give Divider() for allowing space between two textfield and add style as required for the textfield to be displayed.
Step 8 - Adding padding to bottom and given 15.
Step 9 - Adding Button of forgot password inside the HStack to align the right corner of the screen with the Text as shown below.
Fig 2 - Adding Textfield and SecureField with Forget Password
Step 10 - Add a button with the title “Login” for clicking the login functionality inside the VStack.
Step 11 - In this button Action will be added inside the action closure function and can add text to the button (i.e Title) and Style the button as shown.
Fig 3 - Adding Button with Action and Text
Step 12 - Add a button which will have an action to move to SignUp Screen inside the HStack with spacing. Where the SignUp text will be clickable which we implement using Attribute text Similarly in SwiftUI it is implemented in Simple Way.
Fig 4 - "Don't have an Account ? Sign Up"
Final Result - Login Screen with PhoneNumber and Password using SwiftUI
Conclusion
SwiftUI is new to everyone and might take time to get stable as a framework. But SwiftUI is the future of iOS development. There are a lot of things to learn in SwiftUI.
0 notes
expertappdevs · 4 years ago
Text
Building <InputAccessoryView> For React Native
Tumblr media
Introduction -
First, we need to know what exactly “InputAccessoryView” is, it is basically mentioned in the Apple developer documentation, so we know about the InputAccessoryView it is a custom view that occurred at the top of the system keyboard when any receiver becomes the first responder.
You can check this in the image below.
Tumblr media
InputAccessoryView redeclares anything which he inherits from UIResponder because it is based on UIResponder and InputAccessoryView has the property of reading and write and also manages a custom view.
Responder infrastructure first mounts the view then keeps it in sync with the system keyboard. Some of the gestures are applied to the InputAccessoryView that gestures are like tap, drag, etc which use to dismiss the keyboard.
Use Cases -
There are two main use cases of InputAccessoryView.
You can create a view like Facebook composer view picker
You can also design a toolbar
The second scenario is sticky text inputs:
Tumblr media
Objective-C UIResponder -
There are separate view designs for objective c and <TextInput> has become a responder for an instance of UITextView or UITextField.
API Designs -
I think now we can understand the <InputAccessoryView>, and how to use it as well, so now we are going to design the API for both the cases.and it works well with react-native components.
First, we check it for the keyboard toolbar, there are the following things for consideration.
<InputAccessoryView> we want to hoist generic react-native hierarchy.
It is also used for manipulating the application state and it detaches the view hierarchy.
Particular <TextInput> is also linked to <InputAccessoryView>
We can also share the multiple text inputs without duplicating the code
Second, for sticky notes, the following are some points.
For sticky note support, it adds some more constraints.
For the design purpose, the input accessory has a text input as a child view.
We can manually set the generic view.
Some Pitfalls -
Continue Reading: InputAccessoryView
0 notes
appsgym · 4 years ago
Text
Swift Keyboard Control for TextFields and TextViews
Keyboard Control as User Navigates TextFields and TextViews on Table View Form
Tumblr media
Scenario
Our app will allow users to tap between TextFields and TextViews and control the keyboard display (hide or show) as required. The code will ensure that the keyboard does not override (hide) the TextField or TextView the user has in focus.
Technique
We shall utilise the Delegate feature so the view, as the delegate to the TextFields and TextViews, can control the keyboard display. Then we shall use GestureRecognizer to detect user gestures and check the TextField or TextView BeginEditing and EndEditing conditions and animate the fields or views to move them up or down, depending on the keyboard display status.
Audience
The article is for Swift developers who seek complete, integrated, proven, code-centric solutions to speed up their development projects.
App Model
We based the article on the AppsGym Books model app, published on Apple’s App Store (as 8Books), and you can download the complete Xcode project on AppsGym.com, for free.
User Interfaces
NewBookTableViewController.swift and EditBookTableViewController.swift control the layout, order, and navigation of the corresponding UITableViewControllers.
Logic
NewBookTableViewController.swift contains keyboard control logic, which monitors and detects user taps on the form fields and reacts accordingly.
There are 7 TextFields on the New Book view: Title, Author, Series, No in Series, Category (Genre), Source, and Format. Each field has a Tag on the Storyboard (e.g., titleTextField.tag = 1) and each behaviour is governed by 3 textField functions, which we shall utilise to control the textField attributes and movement by controlling the becomeFirstResponder() function.
textFieldShouldReturn(..), textFieldDidBeginEditing(..), and textFieldDidEndEditing(..)
There are 2 TextViews on the New Book view: Synopsis and Notes. We shall use 2 textView functions to control their behaviour: textViewDidBeginEditing (..) and textViewDidEndEditing(..).
Code
We shall separate the code of TextFields and TextView to make it easier to focus on each group keyboard control.
TextFields
Tumblr media
NewBookTableViewController.swift Initialise Variables
// Tags are used to Auto Jump to next TextField; see func textFieldShouldReturn    @IBOutlet weak var titleTextField: UITextField!        { didSet {            titleTextField.tag = 1            titleTextField.delegate = self    }  }    @IBOutlet weak var authorTextField: UITextField!        { didSet {            authorTextField.tag = 2            authorTextField.delegate = self    }  } ...    @IBOutlet weak var formatTextField: UITextField!        { didSet {            formatTextField.tag = 7            formatTextField.delegate = self    }  } ....
NewBookTableViewController.swift viewDidLoad()
...       let tapGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(NewBookTableViewController.tap(_:)))        view.addGestureRecognizer(tapGestureReconizer) ...       }
NewBookTableViewController.swift Keyboard Control
   func textFieldDidBeginEditing(_ textField: UITextField) {        textField.layer.borderWidth = 2        textField.layer.borderColor = UIColor.orange.cgColor    }         func textFieldDidEndEditing(_ textField: UITextField) {        textField.layer.borderWidth = 0        textField.layer.borderColor = UIColor.clear.cgColor    }
   @objc func tap(_ sender: UITapGestureRecognizer) {        view.endEditing(true)    } view raw
TextViews
Tumblr media
NewBookTableViewController.swift Initialise Variables
class NewBookTableViewController: UITableViewController, UITextViewDelegate { ...    @IBOutlet weak var synopsisTextView: UITextView!    @IBOutlet weak var notesTextView: UITextView!  ...  
ewBookTableViewController.swift viewDidLoad()
override func viewDidLoad() {        super.viewDidLoad() ...        self.synopsisTextView.delegate = self    // keyboard control        self.notesTextView.delegate = self    // keyboard control        synopsisTextView.text = ""        notesTextView.text = "" // stringCurrentDate() + "nn" ...        let tapGestureReconizer = UITapGestureRecognizer(target: self, action: #selector(NewBookTableViewController.tap(_:)))        view.addGestureRecognizer(tapGestureReconizer) ... } // end viewDidLoad()
NewBookTableViewController.swift** Keyboard Control**
/ 4 funcs To dimiss keyboard and move the textView UP/Down when the keyboard shows    @objc func tap(_ sender: UITapGestureRecognizer) {        view.endEditing(true)    }        func textViewDidBeginEditing(_ textView: UITextView) {        textView.layer.borderWidth = 2        textView.layer.borderColor = UIColor.orange.cgColor        animateViewMoving(true, moveValue: 100)    }        func textViewDidEndEditing(_ textView: UITextView) {        textView.layer.borderWidth = 0        textView.layer.borderColor = UIColor.clear.cgColor        animateViewMoving(false, moveValue: 100)    }        func animateViewMoving (_ up:Bool, moveValue :CGFloat){        let movementDuration:TimeInterval = 0.3        let movement:CGFloat = ( up ? -moveValue : moveValue)        UIView.beginAnimations( "animateView", context: nil)        UIView.setAnimationBeginsFromCurrentState(true)        UIView.setAnimationDuration(movementDuration )        self.view.frame = self.view.frame.offsetBy(dx: 0,  dy: movement)        UIView.commitAnimations()    }
**
**
Keyboard Height
The code snippets above used a simple moveValue of 100, which would suffice for most scenarios. However, a more accurate measure would be the actual keyboard height on the device.
The code snippet below shows how to obtain the Keyboard Height. If you want to use this method, substitute the keyboardHeight for the ‘100’ in the moveValue argument for TextView. You can optionally use keyboardHeight in the TextField functions for more precise controls.
       if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {          keyboardHeight = keyboardSize.height          print(#function, keyboardHeight)
           // The 1st keyboardWillShow gets the keyboard size height then observer removed as no need to get keyboard height every time it shows or hides
           NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)                        // Store KeyboardHeight in UserDefaults to use when in Edit Mode
           UserDefaults.standard.set(keyboardHeight, forKey: "KeyboardHeight")            UserDefaults.standard.synchronize()        }    } // end func keyboardWillShow
The article covered the complete logic and code to control the behaviour of TextFields and TextViews, so the keyboard does not obscure the relevant fields or views behind it. Hope you find it useful in your app. Thanks for reading!
0 notes
ios-goodies · 4 years ago
Text
Week 375
Happy Thursday! I’ve been waiting a bit to send out this issue even though it’s been ready for a while because I wanted to see if Apple announced something about WWDC. The last 3 years, they announced the dates on 13 or 14 of March, so we’re almost there. I’m probably too excited about this, but let’s see what the rest of the week brings us.
Marius Constantinescu
Articles
Code Generating Swift Mocks with Sourcery, by @V8tr
Tuist Template: What is it and how to create them, by @sarunw
Building a Customizable UITextField with Combine, by @daisyr317
How to use @autoclosure in Swift to improve performance, by @twannl
Tweaking The iOS System Fonts, by @kharrison
UIMenu: Comprehensive guide, by @nemecek_f
Getting to Know the Simulator Better, by @AndyIbanezK
Frameworks: embed or not embed that’s the question, by @Leo_Pugliese
Videos
Build Clubhouse in SwiftUI 2.0 and Dark Mode (SwiftUI Tutorial, SwiftUI 2.0, Clubhouse App Clone), by @tundsdev
Credits
mecid, vlondon, zntfdr, onmyway133, V8tr, sarunw
0 notes
renupunjabi · 8 years ago
Text
Blocks vs Delegates vs Notifications in iOS Programming
There are two important questions that I'll try to answer in this blog which are very commonly asked in iOS developer interviews:
1) When to use Blocks vs Delegates for call backs?
2) When should you use Notifications vs Delegates?
First half of this blog will answer the first question and then we will jump to the second.
Lets start by defining Blocks and Delegates and then we will discuss when to use what?
Blocks: are self contained pieces of executable code. They are objects. Hence, they can be passed into methods.
Delegates: Delegation is handling the responsibility of execution of an event by one object to the other, thus delegating other object for that event
Eg: TableViewControllers always confirm to UITableViewDlegate. Here UITableView assigns the tableViewController as its delegate. So whenever a user selects a row of the tableView, delegate methods like didSelectRowAtIndexPath is called, our TableViewController (being a delegate of UITableView) handles the selection of row event. 
When to use Blocks vs Delegates:
Prefer to use delegate pattern if an object has multiple distinct events. For example UITextField have multiple distinct events. It should tell when shouldBeginEditing, didBedingEditing, shouldEndEditing, didEndEditing, shouldReturn etc
If you are targeting to get call backs in your ViewController on several steps in a process - use Delegation. For example, the process of drawing the table in the view of viewcontroller, it needs to know the number of sections, number of rows in each sections and info to display in cell for each row. With the help of delegation design using UITableViewDataSource, the UITableView is able to communicate back and forth with ViewController.
If you are targeting the results from executing a process, use Blocks -- From Apple documentations- "Blocks are particularly useful as a callback because the block carries both the code to be executed on callback and the data needed during that execution". In other words, they are generally useful to inform the viewController whether a certain event is success or failure. For example, if you are trying to download images asynchronously in your helper classes, then the completion block in the ViewController, informs whether the download succeeded or failed. Hence the view gets updated accordingly. Here is the sample source code. Notice, that we make fetch call to get Menu Category list in MapCoordinator class and once we receive the results from processing the API request, we show the results in detail view for the selected restaurant. This is a perfect example of a process, where you are expecting a result from it in order to update your view in TableViewController. This is where blocks come in handy and are quite helpful in informing the view whether  an operation is success or a failure.
Use Blocks when object is singleton as you cannot use Delegation. The reason is explained in the third point of my second half of this blog under Notification vs Delegates.
Now, here starts the second half of part of this blog. Here we will try to answer the question- "When should you use Notifications vs Delegates?"
We've already defined Delegates above. So, I'll start by giving you an overview of what do Notifications do for us.
NSNotifications: are used to notify the observer objects about completion of certain event (method/operation). Notifications is very useful as it decouples the objects (meaning, the classes do not have to know anything about each other - no inheritance or importing and they still get notified if they are the observer to a certain event in the other class).
Notifying another object about the occurrence of an event can be achieved with all of the above design patterns.
Question is - When do you use Notificatiion vs Delegates?
Delegate is used when there is mainly one class to be notified of the completion of an operation at a given time. 
NSNotifications are used when there are multiple observers (classes) waiting to be notified for the completion of a certain event.
Other conditions to be considered when deciding the use of NSNotification vs Delegates:
1) If the object you are trying to communicate is unknown then NSNotification can be a better option. For Eg: Apple provided keyboard view which is not accessible for development yet it is important to be notified about its appearance and disappearance if there are custom things to be performed during those events. In such cases, notifications can be handy. Although, it has a small price to pay. The metadata about the info you are trying to pass (if any) is a form of dictionary (userInfo) which could be a little clumpsy to work with vs straight parameters data provided by delegates. But its still worth it as here you are trying to communicate between multiple classes and dealing with an unknown object. 
2) Consider your object model as a tree. You may have an object B which may inherit from object A. Object C is a child of B and object D is a child of C and so on. Delegation is the answer when you have to pass data back and forth between an objects in such inheritance chains. But if you have objects which are built completely in separate parts of the object tree, then NSNotifications are the best way to convey messages to all or between the objects.
3) Delegates should only be used when the object being the delegate owns the object doing the delegation. Apple demos this by making the TableViewController the owner of UITableview where the TableViewController become the delegate of UITableView. For this reason, singletons should never have delegates because they are not the owner of any other object. They stand alone or they can be considered as child of application. If you attempt to do so, then the first object becomes its delegate but when second object assigns itself as delegate of the singleton then the previous delegation connection with first object gets overridden with the new delegation from second object without informing the first object. This way, first object never knows that its delegation link is broken and still thinks that is is the delegate of the singleton. This may break your application at some point.
To summarize - 
Use delegates when the communication is between two objects. 
Use Notifications when you want to communicate messages to multiple objects at the same time
Use blocks, when we need the results from the event/process/network call to do further action (generally displaying it on the UI).
1 note · View note
shivamsingh98 · 6 years ago
Text
Security Issues App Developer Need To Know While Developing Apps.
Tumblr media
When developing a mobile application that processes any user data, it is crucial to pay attention to security issues. These issues are particularly acute for applications where the full name, phone numbers, passports, and other personal information appear. Mobile app development in Miami has developed and continues to create several projects of this kind. Based on this experience, Tech companies have developed a set of security requirements that an Android developer in Miami has to consider while developing android apps. Below are the main security issues to be considered;
1. Server connection
Before the release of iOS 9, applications could freely make requests to any address via HTTP. Starting with iOS 9, Apple decided to impose strict network connection requirements and developed App Transport Security (ATS) rules, according to which all requests to the Internet should be made via the HTTPS protocol and encrypted using TLS 1.2 (with forwarding secrecy support). The operating system itself by default follows these requirements; therefore, it is only necessary to comply with them from the server side. Android developers in Miami are well conversant in programming a secure server connection. Contact them anytime when you need an android app developed.
2. Authorization in the application In many applications, authorization occurs by entering a 4-6 digit PIN code, invented by the user during registration. Naturally, this code cannot be stored in its pure form either on the device or on the server. Verification of the entered code for correctness should occur on the server, where it is sent as a hash obtained using the PBKDF2algorithm. For the operation of this algorithm, SALT is needed - a set of random characters that is generated once during registration and is used for all subsequent authorizations 
3. Anti-fraud Mobile Application Development companies in Miami are conversant with all kind of fraud that can take place on your android phone. Even if the attacker has received full access to the phone or user account, they have ways to block his ability to perform operations in the application. Also, when using the app, you can send data about the user's geolocation to the server (provided that he gave access to it). If operations are performed from an ideal place, it is possible to suspend the service until the user confirms that he is actually performing the actions.
4. Data input It is essential to ensure that you are secure when entering information within the application. For example, in most text fields, Expert Application developers in Maimi disable the autocomplete feature (the UITextField autoCorrectionType property). If this is not done, the input data (which may be personal) will be indexed by the operating system and will appear as options for auto-completion in other applications. And all text fields in which passwords are entered are, of course, masked and do not support the ability to copy/paste. To ensure full protection of the service, all its components must comply with information security requirements. However, the guarantee of security can never be one hundred per cent. The possibility of an attack always exists, and all the above points only reduce the risks or increase its cost. Therefore, the only thing that can be done when developing applications is to get an expert mobile application developer in Miami who adheres to those security principles.
0 notes
udemy-gift-coupon-blog · 6 years ago
Link
iOS 11 Swift 4 build a To Do List App, UIKit, CoreData,+more ##udemycourses ##UdemyFreeCoupons #app #Build #CoreDatamore #iOS #List #Swift #UIKit iOS 11 Swift 4 build a To Do List App, UIKit, CoreData,+more Learn Swift, Xcode, and the iOS SDK from a unique perspective by developing a more involved todolist app for the Apple App Store. As a developer it is extremely important you learn specific concepts and technologies that are in demand. In my opinion it is equally important to learn from multiple perspectives and not from just one or two specific instructors. That being said, I think my course offers a very unique perspective on development and this course will teach you the following concepts from my perspective as a professional developer: CAGradientLayer, CoreData, UITableViews, Object Oriented Programming Subclassing, UIKit, self defined Protocols, OptionSet(s) and at least a few more concepts that are contained within the bigger ones. For example, in this course you will learn how to build a custom UITableViewCell and that would fall under learning about UITableViews which is why I didn't initially mention it in this description. Who this course is for: Beginners, and professionals who want to learn the latest in Swift 4, Xcode 9, and the iOS SDK In this course I walk you very carefully yet at a swift speed (no pun intended lol) so beginners and professionals will both have something to grasp Developers interested in learning Apple's CoreData framework / library Developers interested in learning Apple's UIKit framework Developers interested in learning how to use UITableViews, UILayoutConstraints programmatically!, UITextFields, and much more! 👉 Activate Udemy Coupon 👈 Free Tutorials Udemy Review Real Discount Udemy Free Courses Udemy Coupon Udemy Francais Coupon Udemy gratuit Coursera and Edx ELearningFree Course Free Online Training Udemy Udemy Free Coupons Udemy Free Discount Coupons Udemy Online Course Udemy Online Training 100% FREE Udemy Discount Coupons https://www.couponudemy.com/blog/ios-11-swift-4-build-a-to-do-list-app-uikit-coredatamore/
0 notes
jacob-cs · 7 years ago
Link
original source : https://stackoverflow.com/questions/35452908/swift-add-constraint-programmatically
뷰obj.addSubview(섭뷰obj) 를 통해 먼저 subview를 상부 view에 덧붙인다음 contraints를 적용해야 한다.
I ran into the same problem that you described earlier. In order to make the programmatic subview, (in your case the paymentTextField) you have to add this to the subview first and then apply your constraints.
By adding the subview to view first, this ensure both views have the same parent.
Very late, but hope this helps anybody else.
https://stackoverflow.com/a/41852169/3151712
0 notes
softshareblog-blog · 8 years ago
Text
Swift 4,Xcode 9:用戶註冊流程和 iOS Keychain
Swift 4,Xcode 9:用戶註冊流程和 iOS Keychain
課程簡介
學習使用 Swift 4 和 Xcode 9 建構用戶登入,用戶註冊,用戶註銷功能
從這 2.5 小時的課程,你會學到
使用 UILabel(s ),UITextField(s) 和 UIButton
處理 UIButton 的行為
將資料儲存在安全的地方-使用 iOS Keychain
發送 HTTP 請求和處理 HTTP 回應
將 NSDictionary 型別的物件轉換成 JSON 格式和從 JSON 格式轉換成 NSDictionary 型別的物件
顯示 spinning Activity Indicator 做進度顯示
顯示提示訊息對話框
實現用戶註冊和登錄頁面
顯示和離開 UIViewController
英文字幕:有
想要了解如何將英文字幕自動翻譯成中文? 請參考這篇��How-To
課程網址 [ 限時免費中 ]
Tumblr media
Sponsored by Udemy
贊助 Soft…
View On WordPress
0 notes