Skip to content

This is a repo for me to keep track of my self training

Notifications You must be signed in to change notification settings

madclouds/code-better

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 

Repository files navigation

code-better

This is a self help repo for me to keep track of my journy as I challenge myself to code better.

Mostly this is for iOS development, but who knows what else will be in here.

I've been watching some videos from Sean Allen: https://www.youtube.com/channel/UCbTw29mcP12YlTt1EpUaVJw

Structs vs Classes

Stuff I want to learn

  • Hashable protocol
  • Sequence protocol: A type that provides sequential, iterated access to its elements. (the base or foundation of collections)
  • Collection protocol: A sequence whose elements can be traversed multiple times, nondestructively, and accessed by an indexed subscript (inherits from Sequence)
  • Bidirectional Collection: A collection that supports backward as well as forward traversal.
  • Other Protocols
  • Optionals - it's just an enum with case some or none.
  • Error Handling!
  • Generics
  • Iterators

After talking with my manager, we've talked about different ways for me to improve my development skillsets on my own. Here are some of our ideas:

Ideas for learning

Specific WWDC Videos I want to watch: ✅ == watched

2013
  • https://developer.apple.com/videos/play/wwdc2013/502/ Introduction to Sprite Kit
  • https://developer.apple.com/videos/play/wwdc2013/404/ ✅ Advances in Objective-C
    • #import > Copy/paste text headers into .m files
    • @import > Imports module (which encapsulates a framework and is compiled separately) Imports the API - Semantic import (doesn't need to parse headers. Local macro definitions have no effect on framework API)
    • Submodules @import iAd.ADBannerView; Similar to #import <iAd/ADBannerView.h>
    • Autolinking. No need to manuallly "link binary with libraries" (I don't get this yet)
    • Xcode Automatically changes #import into @import now... No code changes needed
    • how's it work? Module Maps > Establish relationship between headers and modules. Modules are cached in derived data. Next time you import a module, it is already there.
    • instancetype vs id - A contextual keyword, only for return types. Subclasses do not need to redeclare instance type methods. The compiler contextually matches the return type to the receiver
    • Enums are/were essentailly global integers
2014
2015
2016
2017
2018
  • https://developer.apple.com/videos/play/wwdc2018/402/ Getting the Most out of Playgrounds in Xcode

  • https://developer.apple.com/videos/play/wwdc2018/223/ Embracing Algorithms

    • Talks about different collection methods
    • Talked about different protocols
  • https://developer.apple.com/videos/play/wwdc2018/406/ Swift Generics

  • https://developer.apple.com/videos/play/wwdc2018/214/ Building for Voice with Siri Shortcuts

  • https://developer.apple.com/videos/play/wwdc2018/220/ High Performance Auto Layout

  • https://developer.apple.com/videos/play/wwdc2018/215/ Introducing ClassKit

  • https://developer.apple.com/videos/play/wwdc2018/211/ ✅ Introduction to Siri Shortcuts

    • Define a shortcut for each action you want
      • Accelerate user to perform a key function of your app
      • Be of persistant interest to the user. The user might want to do multiple times
      • Be executable at any time. No state!
      • 2 APIs for supporting shortcuts:
        • NSUserActivity is a light weight way to let siri know
          • Opens something in your app
          • Represents showing items that you index in spotlight search of for handoff.
          • you use use this for lots of activities in your app so siri can offer better suggestions
          • Example:
            let activity = NSUserActivity(activityType: "com.AppCoda.SiriSortcuts.sayHi") // 1
            activity.title = "Say Hi" // 2
            activity.userInfo = ["speech" : "hi"] // 3
            activity.isEligibleForSearch = true // 4
            activity.isEligibleForPrediction = true // 5
            activity.persistentIdentifier = NSUserActivityPersistentIdentifier(rawValue: "com.AppCoda.SiriSortcuts.sayHi") // 6
            view.userActivity = activity // 7
            activity.becomeCurrent() // 8
            
        • Intents. Siri has built in intents. Custom intents!
    • Donate shortcut tell system every time the user does something in your app that you expose a shortcut for. Lets siri learn when and where is the right time to sugest your shortcut.
      • Turn on debugging by going to Settings > Developer and enable Display Recent Shortcuts and Display Donations on Lock Screen
    • Handle shortcut when the user wants to use your shortcut, you need to be ready for your app or app extension to handle
  • https://developer.apple.com/videos/play/wwdc2018/235/ UIKit: Apps for Every Size and Shape

General Notes

  • Set Algebra: Subtraction, Intersection, Union.
  • NSSet is like a dictionary without values.
  • Options... if let, ?? ! !

Internal Frameworks

  • Whats New
  • TubePlayer
  • Planning Center Cache
  • Random Image
  • Upload Service
  • Plannin Center Router
  • Audio Player Cache
  • MCT Audio Player
  • Alert View
  • Services Sidebar
  • Document Store
  • PCOKit
  • PCOCocoa
    • Network Cache
    • Loper
    • Socket Rocket
    • Open Sky Operation
    • Planning Center Auth
    • MCT Object Store
    • MCT JSON

3rd Party Frameworks in PC

  • Zendesk
  • 1Password
  • Fabric
  • Crashlytics
  • React Native

External Frameworks

Apple Framework

Security

More frameworks to review:

Mentor Notes

11/16 @11am notes:

Notes for next Mentorship

  • Talk about sidebar blockout data grouping NSArray <NSArray<PCOBlockout *> *> *blockouts Used a NSFetchedResultsController with a sectionNameKeyPath
  • Talk about code compilation process. Talk about what happens when you hit command+B, and when you archive.
  • Talk about schedule conflicts and how to keep them out of the database, and use them in memory only. (check BlockoutDeclineExistingPlansPickerController)
  • Review JSON mapping and Core Data interactions. Talk about API call.
  • Write more swift!

Mentor Stuffs

  • PCOServicesCoreDataStack.m uses + (BOOL)prepareCoreDataStack:(NSError **)error. What's the double ** about. I know &error is a reference pointer, but I don't know what ** is. Answer: ** is a pointer to a pointer. Since functions in C take arguments by value, it means you can't change the value of the argument in that function. But, by providing a level of indirection and passing a pointer to the pointer, you can change the value.

Mentor notes from 12/6

  • Talked about writing swift in services with new controllers. and use snapkit maybe for swift stuff.
  • Try talking about implementation strategy with James before working on another big task.

Questions for next session

  • Review where state should be held for Household Filters (Notes in notebook)

Talk about different

  • Imparative programming
  • Functional programming
  • Object Oriented programming
  • Inheritance-based programming
  • Prototytpe-based programming
  • Declarative programming

^ Relevant https://flutter.io/docs/resources/faq#what-programming-paradigm-does-flutters-framework-use

  • Find a video to watch and discuss next time.

1/2/2019 notes:

Got together to talk about blockout conflict implementation strategy found here: https://gist.github.com/madclouds/47e6edc3666cf963b73bbdc5f5e8ecf4

1/3/2019 notes:

Watched video together - Embracing Algorithms - https://developer.apple.com/videos/play/wwdc2018/223/
Learned about tripple slashes in Xcode /// for documentation that's included in .swiftdoc and displayed within xcode. Look through swift guides Looked at big O notation and talked about the different complexities

Questions for next meeting:

Unit Testing
  • Wrote some tests for MCTJSON JSONHelper class
  • Write tests for any public interfaces!
Task to work on together
  • What's the correct way to disable the header highlight in on a dashboard card based on data. (just an exercise)

Swift

  • Any new file should be written in Swift

[self.orderedHouseholdMembers filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, __unused NSDictionary<NSString *,id> * _Nullable bindings) {

Becoming a better programmer

https://www.youtube.com/watch?v=85fXs6cQETQ Models of learning: http://pics.pco.bz/fc9ab0f1fb96

Try Fastlane for build automation. https://docs.fastlane.tools/getting-started/ios/beta-deployment/

NS namespace belongs to NextStep, a company Apple bought and based MacOS/iOS on. Example NSObject. Start watching Core Data course: https://classroom.udacity.com/courses/ud325

Course Notes
  • Core Data - Data layer management framework

    • Data Structure, relationships, changing models and updating UI when models change.
    • Core Data is a framework/library/bundle of code
    • referential integrity - Core Data uses two-sided relationships. Core Data traverses the web of entity class instances (object graph) and makes sure all affected references are updated.
    • Deleteion Rules:
      • Cascade: Deleteing a notebook will causes all of the notes to be deleted
      • Nullify means the relationship will simply be removed, but the referenced notebook remains
  • Faults - relationships are not immediately loaded. Instead, Core Data has a mechanism called faulting. Faulting allows any attribute or relationship to be in a special state where it is promised to load when needed. When you fetch a managed object, its relationships are initially represented as faults.

Core Data Stack
  • 1 or more Managed Object Context(s)

    • Scratch pad to edit or update NSManagedObjects or create new ones
  • Managed Object Model

    • Describes data structure and relationships - .xcdatamodeld file
  • Persistent Store Coordinator

    • Connects to 1 or more persistant stores. Translates store objects into managed objects, or managed objects into stored objects.
    • A mediator for turning persisted data into managed objects and turning managed objects into persisted data
  • Persistent Container

    • set up the rest of stact
    • provie useful methods for working with contexts
  • Core data migration. .xcmappingmodel

    • automatic (light weight) vs custom
    • custom: subclass NSEntityMigrationPolicy and use createDestinationInstances(forSource sInstance: NSManagedObject, in mapping: NSEntityMapping, manager: NSMigrationManager)
    • Services doesn't use a migration/merge policy. Instead builds the stack from scratch.
  • Concurrency:

  • main queue vs private queue

  • Concurrency Types:

  • NSPrivateQueueConcurrencyType: Specifies that the context will be associated with a private dispatch queue

  • NSMainQueueConcurrencyType: Specifies that the context will be associated with the main queue.

  • Merge Policies

NSErrorMergePolicyType
    Default policy for all managed object contexts.
    NSMergeByPropertyStoreTrumpMergePolicyType
    A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the in-memory changes trumping external changes.
    NSMergeByPropertyObjectTrumpMergePolicyType
    A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by individual property, with the external changes trumping in-memory changes.
    NSOverwriteMergePolicyType
    A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by pushing the entire in-memory object to the persistent store.
    NSRollbackMergePolicyType
    A policy that merges conflicts between the persistent store's version of the object and the current in-memory version by discarding all state for the changed objects in conflict.
  • MCTObjectContext.m line 291:
+ (NSDictionary *)defaultPersistentStoreOptions {
    return @{
             NSMigratePersistentStoresAutomaticallyOption: @YES,
             NSInferMappingModelAutomaticallyOption: @YES
             };
}

Transpose Quick View add Minor Support

Talked with James about how to tackle this card: https://trello.com/c/l4VQ5jVV Solution: https://gist.github.com/madclouds/8cc11aad8e7dc37660a3e4df515c0a49


Check out this crash report together: http://crashes.to/s/ac5c41cb64c

Review this together: https://codesigning.guide/

Check out this together: https://github.com/fastlane/examples

Can't get fastlane working for Services

Output:

▸ Signing /Users/erikbye/Library/Developer/Xcode/DerivedData/Services-awpfsigwemreoghcurxsonpypbpz/Build/Intermediates.noindex/ArchiveIntermediates/Services/InstallationBuildProductsLocation/Applications/Services.app
▸ Touching Services.app.dSYM
▸ Archive Succeeded
[16:11:20]: Exit status: 1

+---------------+-------------------------+
|            Build environment            |
+---------------+-------------------------+
| xcode_path    | /Applications/Xcode.app |
| gym_version   | 2.115.0                 |
| export_method | app-store               |
| sdk           | iPhoneOS12.1.sdk        |
+---------------+-------------------------+

[16:11:20]: ▸ Check dependencies
[16:11:20]: ▸ Code Signing Error: No profiles for 'com.ministrycentered.PlanningCenter.ServicesSchedule' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching 'com.ministrycentered.PlanningCenter.ServicesSchedule'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
[16:11:20]: ▸ Swift 3 mode has been deprecated and will be removed in a later version of Xcode. Please migrate "Services Schedule" to Swift 4.2 using "Convert > To Current Swift Syntax…" in the Edit menu.
[16:11:20]: ▸ Swift 3 mode has been deprecated and will be removed in a later version of Xcode. Please migrate "Services Schedule" to Swift 4.2 using "Convert > To Current Swift Syntax…" in the Edit menu.
[16:11:20]: ▸ Code Signing Error: Code signing is required for product type 'App Extension' in SDK 'iOS 12.1'
[16:11:20]: 
[16:11:20]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[16:11:20]: 📋  For the complete and more detailed error log, check the full log at:
[16:11:20]: 📋  /Users/erikbye/Library/Logs/gym/Services-Services.log
[16:11:20]: 
[16:11:20]: Looks like fastlane ran into a build/archive error with your project
[16:11:20]: It's hard to tell what's causing the error, so we wrote some guides on how
[16:11:20]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[16:11:20]: Before submitting an issue on GitHub, please follow the guide above and make
[16:11:20]: sure your project is set up correctly.
[16:11:20]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[16:11:20]: the full commands printed out in yellow in the above log.
[16:11:20]: Make sure to inspect the output above, as usually you'll find more error information there

Fixed! ^

  • Needed to manually set the profiles to the ones generated by fastlane's Match service.

Design Patterns!

  • I want to get better at them. I want to talk about them and better understand how and why to use them. I know all the terms needed to program, but I don't use them often enough to combine all the pieces together.

  • Talk about push notification bug together. Pair Programming!

Notes for next meeting

  • Analyize an open source project together
  • Find a list of programming terms and talk through each one.

About

This is a repo for me to keep track of my self training

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published