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
// put a map into the View | |
var map = new MKMapView (UIScreen.MainScreen.Bounds); | |
View = map; | |
//allows user location to be shown on a map | |
map.ShowsUserLocation = true; | |
//get my current geo-location lat/long coordinates | |
var myCoord = map.UserLocation.Coordinate; | |
Console.WriteLine ("lat {0}, long {1}", myCoord.Latitude, myCoord.Longitude); |
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
listView.ItemSelected += async (object sender, SelectedItemChangedEventArgs e) => { | |
//Paste this ---v | |
// Prevents .ItemSelected from running again when SelectedItem is set to null on line below | |
if (listView.SelectedItem == null) | |
return; | |
// Sets the SelectedItem so it can be used by the Switch statement below | |
var whichCategory = (Category)e.SelectedItem; | |
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
public class CircleView : UIView | |
{ | |
private UIColor color; | |
public CircleView (UIColor color) | |
{ | |
this.color = color; | |
} | |
public override void Draw (CGRect rect) |
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
class InitialLBPSegue: UIStoryboardSegue { | |
override func perform() { | |
var firstVCView = sourceViewController.view as UIView! | |
var thirdVCView = destinationViewController.view as UIView! | |
let window = UIApplication.sharedApplication().keyWindow | |
window?.insertSubview(thirdVCView, belowSubview: firstVCView) | |
thirdVCView.transform = CGAffineTransformScale(thirdVCView.transform, 0.001, 0.001) |
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
public override void ViewDidUnload () { base.ViewDidUnload (); // Clear any references to subviews of the main view in order to // allow the Garbage Collector to collect them sooner. // // e.g. myOutlet.Dispose (); myOutlet = null; ReleaseDesignerOutlets (); } |
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
// credit -> http://acqui-hire.me/dependency-injection-with-the-cake-pattern-in-swift/ | |
public struct User { | |
public let username: String | |
public let password: String | |
} | |
public protocol UserRepository { | |
func findByUsername(username: String) -> User? | |
} |
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
//create a custom segue on storyboard between two ***UIViewControllers*** (ie. this example doesn’t need a navigation controller) | |
//use the class below as the custom segue class. | |
//use your own identifier eg. “customSegue”) | |
class CustomSegue: UIStoryboardSegue { | |
override func perform() { | |
let src = self.sourceViewController |