These are chat archives for devslopes/swiftios9

28th
Oct 2015
Sketchy Swift
@HardcoreIOS
Oct 28 2015 01:18
@spentak Why don’t you call self.benchPress = press, instead you benchPress = press // without calling self
cooll.png
Mark Price
@spentak
Oct 28 2015 01:24
doesn't matter either way
still debating on what I think is best practice. i say just pick one way of doing it and stick with it. You must use self when inside of closures
or when a function parameter has the same name as a variable
Sketchy Swift
@HardcoreIOS
Oct 28 2015 01:25
So why don’t you use self
Aizaz Khaja
@aizkhaj
Oct 28 2015 03:39
I was trying to figure out how to do the exercise on auto layouts. I got stuck at trying to keep the squares in shape and aligned properly. Is it cheating if I clicked on “resolve auto layout issues” button and chose “reset to suggested constraints”? (tbh I didn’t learn much other than “hey, this shortcut got me where I needed to be”)
autolayout.png
Mark Price
@spentak
Oct 28 2015 04:08
If that works then use it :)
Tarek
@TarekSalama
Oct 28 2015 04:17
@metalhe4der Keep trying those excerices again and again. I’m not sure what reset to suggested constraints does but think about it like this:
1- You placed the blue box. You centered it.
2- You have two choices, you either pin it from left and right, or give it a fixed width. You can’t do both unless you’ve calculated it down to pixels. I’m pretty sure this is what confused many people, or at least me when I started using Auto Layout. Don’t put too many constraints or you’ll end up with conflicts.
Aizaz Khaja
@aizkhaj
Oct 28 2015 04:42
@TarekSalama thanks, I managed to get the blue box to fit and align across the 3 displays. I got messed up when I multi selected the yellow and blue to first make equal width and then align leading edge. I went ahead and fixed up the equal width constraint's multiplier and then reversed position of the two items as the video suggested.
But then it would show the yellow box aligned, but the blue box all messed up (because of the multiplier i believe).
and yeah, I ended up with conflicts after too much fiddling around, so I'd just start over again with new boxes
*the blue box's width would get messed up, although it would remain at the top with leading edge alignment
Sketchy Swift
@HardcoreIOS
Oct 28 2015 17:01
I just finished the Build a simple app with OOP, Found some errors. First, at one time, when I double-click one the button, this is what it did. From 40 hp it went to 20 hp,when I clicked again, it increased 40 hp again. Same proccess went until two times. And after he was dead and I click the treasure chest, it stayed there and didn’t hide. Some errors. I am sure there are more
@spentak
Mark Price
@spentak
Oct 28 2015 17:02
99% of the times students tell me there is a big in my code it's actually their bug and not mine ;)
Sketchy Swift
@HardcoreIOS
Oct 28 2015 17:03
I downloaded your project
Antonio Alves
@chucky6
Oct 28 2015 17:03
@spentak i really hope the next course be the intermediate iOS please haha it’s hard to find a good and not confused content
Jack Davis
@jackd942
Oct 28 2015 17:04
+1 ^^^^ @chucky6
Sketchy Swift
@HardcoreIOS
Oct 28 2015 17:04
+1 👍👍👍👍👍👍👍
@chucky6
@spentak If you click the Attack button before the Enemy comes back to life, the treasure doesn’t hide!
solron
@solron
Oct 28 2015 17:06
I´m trying to do the weather app. I was able to do the json request with Alamofire. And able to get out the temperature (the only one I have tried so far. But I´m struggling with the completion handler. I can't figure out how to tell when the download is complete. Tried to replicate what we did in the Pokedex app. If anyone want to have a look: https://github.com/solron/myOpenWeather
Mark Price
@spentak
Oct 28 2015 17:09
looking
@solron you already have it working!
override func viewDidLoad() {
        super.viewDidLoad()

        myWeather.downloadWeather { () -> () in
            self.updateUI()
        }
    }
oh i see, you just aren't calling the completion handler
do this
func downloadWeather(completed: DownloadComplete) {
        let url = NSURL(string: _apiUrl)!
        Alamofire.request(.GET, url).responseJSON { response in
            if let dict = response.result.value as? Dictionary<String, AnyObject> {
                print(dict)
                if let weather = dict["main"] as? Dictionary<String, Double> where weather.count > 0 {
                    if let temp1 = weather["temp"] {
                        let temp = Int(temp1) - 273
                        self._temperature = "\(temp)"
                    }
                }
                completed()
            }
        }
    }
Mark Price
@spentak
Oct 28 2015 17:14
congrats on doing this - will you please post this (screenshots) to the student showcase when you are finished
the line of code i added is completed() where you invoke the callback
sofar.png
Mark Price
@spentak
Oct 28 2015 17:19
results so far
on survey
Antonio Alves
@chucky6
Oct 28 2015 17:19
nice haha can’t wait
Jack Davis
@jackd942
Oct 28 2015 17:19
haha Awesome!
I believe that’s the exact order I would do them in too…I would bump Apple watch up above Win 10 tho
Mark Price
@spentak
Oct 28 2015 17:22
haha well **disclaimer Microsoft reached out to me about building them a Windows 10 course
Jack Davis
@jackd942
Oct 28 2015 17:23
I’ve done a fair amount of C# in the past. I like it, but that was on Win 7 and before…I really like the language, just not the newer OS very much
This message was deleted
and I do have to use it daily in my job
solron
@solron
Oct 28 2015 19:06
@spentak Thanks a lot for spotting that one. I´ve spent last night looking for that one. I will post it to the student showcase when it is done :)
rmarcha06
@rmarcha06
Oct 28 2015 21:01
@spentak Hi, I'm stuck in lesson 116, I got the next error in the console: 2015-10-28 14:56:18.695 marchaShowcaseDev[2733:135830] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. My Info.plist is the next:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb-messenger-api20140430</string>
    </array>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb1144246602270782</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>1144246602270782</string>
    <key>FacebookDisplayName</key>
    <string>Marchadevs Showcase</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UIAppFonts</key>
    <array>
        <string>NotoSans-Bold.ttf</string>
        <string>NotoSans-BoldItalic.ttf</string>
        <string>NotoSans-Italic.ttf</string>
        <string>NotoSans-Regular.ttf</string>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
</dict>
</plist>
Mark Price
@spentak
Oct 28 2015 21:12
Just put NSAllowsArbitraryLoads in there as YES
rmarcha06
@rmarcha06
Oct 28 2015 23:04
Thanks @spentak !!!