Posts

Showing posts from May, 2020

Alternative to carousalView iOS swift

Solution: In iOS it had an alternative for carousal View with google MDCTabBar.You can use mdc tab bar with projection like carousalView.

CVCalender blank but no issues

Solution: It has not the cvcalender issue it's hide because of constraint issues.So check the constraints for the calenderView and set it to correct it will works good...If it was the major problem for you then avoid cvcalender and use MDCalender in cocoapods...It works good...

Create navigation bar with title and subtitle

Solution: You can easily set the title and subtitle using the below method.Just call the below method to set the subtitle to the navigationBar.      func setsubTitle (titleStr: String , subStr: String ,viewControl: UIViewController ) {         let rect = CGRect (x: 0 , y: 0 , width: UIScreen . main . bounds . width , height: 50 )         let titleSize: CGFloat = 20         let subtitleSize: CGFloat = 15         let titleLabel = UILabel (frame: rect)         titleLabel. backgroundColor = . clear         titleLabel. numberOfLines = 2         titleLabel. textColor = . white         let text = NSMutableAttributedString ()         text. append ( NSAttributedString (string: titleStr, attributes: [. font : UIFont . boldSystemFont (ofSize: titleSize)]))         text. appe...

Possible to copy the constraints from one view to another || copy constraints to one xib to another || copy constraints from tableview to collectionView

Solution: Just copy and paste the view form one to another.After that you can delete the constraints and create your own constraints. In iOS not able to copy and paste the constraints.

KDCalender set the present date iOS swift

Solution: You can change the present date in calender with setpresent date.  After that get present date from calenderview but it can be optional...

KDCalender hide the title but not hide the weekdays iOS swift

Solution: First return the header string to ""..If you tried with nil it will be shown. Set the calender style with headerview height to 50 ..After that it will be shown but less height..So we can only show the dayviews..Not the header height..

Height constant given for my view but not hidden iOS swift

Problem: I want to hide and show the view..based on that view other views can be aligned.So i had given height constant to that view.Based on my requirement i had given height constant to that view to 0 and height value..Height constant set but the view not hides. Solution: Please check the clip to bounds for that view.Because if you unchecked that the view constant will ot be updated..If you check that it will update the view..

KDCalender not shows event available in date for showing under dot.

Solution: First must check that if data source is done in that calenderView then only it will works..Like below..      @IBOutlet weak var calenderNew : CalendarView !     override func viewDidLoad () {         super . viewDidLoad ()         calenderNew . delegate = self         calenderNew . dataSource = self }

Push notification not able to export as p12 in iOS swift

Solution: First you have to check that all the certificates are valid and not expired.If any certificate is expired then only the issue will occur.. If expired then delete the one and create new one to build that..

CVCalender monthView not shows constraint issue iOS.

Problem: I had installed CVCalender for my project.In my view menuView shows but dayview not shows. If i tried with weekview it works but monthview it will not works. Solution:    pod 'KDCalendar' , '1.8.2' Please try the above one it will works good.For iOS 10 and below it will works this version.For 10 and above you can try the below one to complete..    pod  'KDCalendar'

Try to install old version in cocoapods but only the latest version installed error swift

Problem: i had tried the following line in pods file for swiftlinkpreview. But it installs the latest version only..      pod 'SwiftLinkPreview' , '~> 2.0.4' Solution:      pod 'SwiftLinkPreview' , ' 2.0.4' Try the above it will works..

TextView component in swiftUI || adjustable height textField || Dynamic height textField in SwiftUI || TextField height change at runtime

Solution: //# MARK: - TextView Component fileprivate   struct   UITextViewAdjustable :  UIViewRepresentable  {      typealias   UIViewType  =  UITextView     @ Binding   var   text :  String     @ Binding   var   calHeight :  CGFloat      var   onDone : (() ->  Void )?      func   makeUIView (context:  UIViewRepresentableContext < UIT extViewWrapper >) ->  UITextView  {          let  textField =  UITextView ()         textField. delegate  = context. coordinator         textField. isEditable  =  true         textField. font  =  UIFont . preferredFont ( forTextStyle: . body )         textField. isSelectable  =  true        ...

SwiftUI textfield with secure entry and email type

Solution: Here we can easily declare the textfield type with email address.Based on that it will show the keyboard type with email entry based inputfields. For password it will be a hidden entry that will control fo your input secret. TextField ( $mail , placeholder : Text ( "Enter email ID" )) . textFieldStyle (. roundedBorder ) . textContentType (. emailAddress ) TextField ( $password , placeholder : Text ( "Enter password" )) . textFieldStyle (. roundedBorder ) . textContentType (. password )

Create unitfields in swiftUI

Solution: If you want to create textfield with units on right side then use the below code.. struct unitField : View {         @ State var textValue : String = ""     @ State var unitFieldValue : String = ""                  var body : some View {             let stack = HStack {                 TextField ( "" , text: $unitFieldValue )                     . background ( Color . themeTextField )                     . cornerRadius ( 10.0 )                     . border ( Color . gray , width: 1 )                 Text ( textValue ). background ( Color . titleBackColor )                      ...

Create textfield with border in swiftUI || textfield corner swiftUI

Solution: Use the below code to create  textfield with border in swiftUI. struct textField : View {     @ State var textValue : String = ""          var body : some View {         let tField = TextField ( "" , text: $textValue )             . background ( Color . black )             . cornerRadius ( 10.0 )             . border ( Color . gray , width: 1 )                  return tField     } }

Invalid escape sequence when declare a long string error in swift iOS

Solution: If you tried to declare a long string then divide that string into multiple and save in few variable and finally combine into single variable. If it contains \ character then it says the above error. Or if your string contains invalid "" sequence then also says the same error.Try to solve those things and compile it will works... 

SwiftUI create label iOS

Solution: You can create one view and call it inside the contentView using the below code. The below code can return and label with fullView width and leading alignment. struct labelView : View {     @ State var labelTitle : String !          var body : some View {         let label = Text ( labelTitle ). frame (minWidth: 0 , maxWidth: . infinity ,alignment: . leading )         return label     } }