This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import MapKit | |
struct MapKitView: View { | |
@State private var selectedResult: MKMapItem? | |
@State private var route: MKRoute? | |
@State private var markerCoordinate: CLLocationCoordinate2D | |
@State private var timer: Timer? | |
@State private var pathCoordinates: [CLLocationCoordinate2D] = [] | |
@State private var currentIndex: Int = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate height for a fixed weidht label | |
* @param UILabel for which height to be calculated | |
**/ | |
-(double)getLabelHeightForLabel:(UILabel *)label{ | |
CGSize constrainedSize = CGSizeMake(label.frame.size.width, 1000); | |
NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys: label.font, NSFontAttributeName,nil]; | |
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:label.text attributes:attributesDictionary]; | |
CGRect requiredHeight = [string boundingRectWithSize:constrainedSize options:NSStringDrawingUsesLineFragmentOrigin context:nil]; |