What’s new in swift 4.2

Good news: Swift 4.2 is now available in Xcode 10 beta! This release updates important Swift 4.1 features and improves the language in preparation for ABI stability. 1. toggle() for Bool swift propose adding a mutating func toggle to Bool. It toggles the Bool. var isVisible = true print(isVisible.toggle()) // false 2. Adding in-place removeAll(where:) to the Standard Library It is common to want... Continue Reading →


Common method in Swift

1. Check for any field empty in NSDictionary class func checkforEmptyValueinDictioanty(dic:NSDictionary)-> Bool{ for (keyVal, dataVal) in dic {   if (dataVal.length()==0){                 println("\(keyVal): \(dataVal.length())")                 return false             }                 ... Continue Reading →

Use different font text in a Label in swift

let secondLabel=UILabel(frame: CGRectMake(0, 16, _screenWidth-2, 20))         secondLabel.textColor=UIColor.whiteColor()         secondLabel.textAlignment=NSTextAlignment.Center         secondLabel.font=UIFont(name: "Arial", size: 12)         bottomView.addSubview(secondLabel)                  let attrSting=NSMutableAttributedString(string: "I agree to the Terms of Service and Privacy Policy.")             ... Continue Reading →

BackWord data passing in xcode.

step 1. Define a protocol in FirstViewController.h #import <UIKit/UIKit.h> @protocol ViewBProtocol - (void)setData:(NSString *)data; @end @interface MSYViewController : UIViewController<ViewBProtocol> @end Step 2. in FirstViewController.m - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ UIViewController* controller = [segue destinationViewController]; if ([controller isKindOfClass:[MSYQuizView class]]) { MSYQuizView* viewCController = (MSYQuizView *)controller; viewCController.delegate = self; } } // where MSYQuizView is second ViewController. //... Continue Reading →

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: